Skip to content

Instantly share code, notes, and snippets.

@thedevdavid
Created September 4, 2023 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thedevdavid/e939e8b9a6b2afa4bf886ce9f83cdd55 to your computer and use it in GitHub Desktop.
Save thedevdavid/e939e8b9a6b2afa4bf886ce9f83cdd55 to your computer and use it in GitHub Desktop.
@shadcn/ui custom remote
<FormField
control={form.control}
name="type"
render={({ field }) => (
<FormItem>
<FormLabel>Work from...</FormLabel>
<FormControl>
<RadioGroup onValueChange={field.onChange} defaultValue={field.value} className="flex flex-wrap">
<FormItem className="flex space-x-1 space-y-1">
<FormControl>
<RadioGroupItem value="remote" className="peer hidden" />
</FormControl>
<FormLabel className="block cursor-pointer rounded-md border border-border p-4 font-normal shadow-sm hover:border-primary peer-aria-checked:border-primary peer-aria-checked:ring-1 peer-aria-checked:ring-ring">
<CheckCircle className="mr-2 hidden h-4 w-4 peer-aria-checked:inline" />
🏖️ Remote
</FormLabel>
</FormItem>
<FormItem className="flex space-x-1 space-y-1">
<FormControl>
<RadioGroupItem value="hybrid" className="peer hidden" />
</FormControl>
<FormLabel className="block cursor-pointer rounded-md border border-border p-4 font-normal shadow-sm hover:border-primary peer-aria-checked:border-primary peer-aria-checked:ring-1 peer-aria-checked:ring-ring">
<CheckCircle className="mr-2 hidden h-4 w-4 peer-aria-checked:inline" />
🤏 Hybrid
</FormLabel>
</FormItem>
<FormItem className="flex space-x-1 space-y-1">
<FormControl>
<RadioGroupItem value="on-site" className="peer hidden" />
</FormControl>
<FormLabel className="block cursor-pointer rounded-md border border-border p-4 font-normal shadow-sm hover:border-primary peer-aria-checked:border-primary peer-aria-checked:ring-1 peer-aria-checked:ring-ring">
<CheckCircle className="mr-2 hidden h-4 w-4 peer-aria-checked:inline" />
🏢 On-Site
</FormLabel>
</FormItem>
</RadioGroup>
</FormControl>
<FormDescription>Office, remote, or a little bit of both?</FormDescription>
<FormMessage />
</FormItem>
)}
/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment