checkbox
shadcn-solidjs/checkboxFreeComponent
shadcn-solidjs publishes no description for this item.
Live preview
live · rendered by the registry
Rendered by shadcn-solidjs on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://shadcn-solidjs.com/r/checkbox.jsonSource
1import * as CheckboxPrimitive from "@kobalte/core/checkbox";2import type { PolymorphicProps } from "@kobalte/core/polymorphic";34import { cn } from "~/lib/utils.ts";5import IconCheck from "~icons/lucide/check";67import type { ValidComponent } from "solid-js";8import { splitProps } from "solid-js";910type CheckboxRootProps<T extends ValidComponent = "div"> =11 & CheckboxPrimitive.CheckboxRootProps<T>12 & { class?: string | undefined };1314const Checkbox = <T extends ValidComponent = "div">(15 props: PolymorphicProps<T, CheckboxRootProps<T>>,16) => {17 const [local, others] = splitProps(props as CheckboxRootProps, ["class"]);18 return (19 <CheckboxPrimitive.Root20 data-slot="checkbox"21 class="peer"22 {...others}23 >24 <CheckboxPrimitive.Input class="peer" />25 <CheckboxPrimitive.Control26 class={cn(27 "border-input dark:bg-input/30 data-[checked]:bg-primary data-[checked]:text-primary-foreground dark:data-[checked]:bg-primary data-[checked]:border-primary data-invalid:data-[checked]:border-primary data-invalid:border-destructive dark:data-invalid:border-destructive/50 peer-focus-visible:border-ring peer-focus-visible:ring-ring/50 data-invalid:ring-destructive/20 dark:data-invalid:ring-destructive/40 flex size-4 items-center justify-center rounded-[4px] border transition-colors group-has-disabled/field:opacity-50 peer-focus-visible:ring-3 data-invalid:ring-3 relative shrink-0 outline-none after:absolute after:-inset-x-3 after:-inset-y-2 data-disabled:cursor-not-allowed data-disabled:opacity-50",28 local.class,29 )}30 >31 <CheckboxPrimitive.Indicator32 data-slot="checkbox-indicator"33 class="[&>svg]:size-3.5 grid place-content-center text-current transition-none"34 >35 <IconCheck36 />37 </CheckboxPrimitive.Indicator>38 </CheckboxPrimitive.Control>39 </CheckboxPrimitive.Root>40 );41};4243export { Checkbox };
What it pulls in
npm packages
More from shadcn-solidjs
All 85 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| accordionaccordion | shadcn-solidjs | Components | Free | 1 dep | |
| alertalert | shadcn-solidjs | Components | Free | 2 deps | |
| alert-dialogalert-dialog | shadcn-solidjs | Components | Free | 2 deps | |
| aspect-ratioaspect-ratio | shadcn-solidjs | Components | Free | no deps | |
| attachmentattachment | shadcn-solidjs | Components | Free | 2 deps | |
| avataravatar | shadcn-solidjs | Components | Free | 1 dep | |
| badgebadge | shadcn-solidjs | Components | Free | 2 deps | |
| breadcrumbbreadcrumb | shadcn-solidjs | Components | Free | 1 dep |
