field
shadcn-solidjs/fieldFreeComponent
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/field.jsonSource
1import type { PolymorphicProps } from "@kobalte/core";2import { Polymorphic } from "@kobalte/core";34import { cn } from "~/lib/utils.ts";5import { cva, type VariantProps } from "class-variance-authority";6import type { ComponentProps, JSX, ValidComponent } from "solid-js";78import { children, createMemo, For, Show, splitProps } from "solid-js";9import { Label } from "./label.tsx";10import { Separator } from "./separator.tsx";1112type FieldSetProps<T extends ValidComponent = "fieldset"> =13 & ComponentProps<T>14 & {15 class?: string | undefined;16 };1718const FieldSet = <T extends ValidComponent = "fieldset">(19 props: PolymorphicProps<T, FieldSetProps<T>>,20) => {21 const [local, others] = splitProps(props as FieldSetProps, ["class"]);2223 return (24 <Polymorphic<FieldSetProps>25 as="fieldset"26 data-slot="field-set"27 class={cn(28 "gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3 flex flex-col",29 local.class,30 )}31 {...others}32 />33 );34};3536type FieldLegendProps<T extends ValidComponent = "legend"> =37 & ComponentProps<T>38 & {39 class?: string | undefined;40 variant?: "legend" | "label";41 };4243const FieldLegend = <T extends ValidComponent = "legend">(44 props: PolymorphicProps<T, FieldLegendProps<T>>,45) => {46 const [local, others] = splitProps(props as FieldLegendProps, [47 "class",48 "variant",49 ]);5051 return (52 <Polymorphic<FieldLegendProps>53 as="legend"54 data-slot="field-legend"55 data-variant={local.variant ?? "legend"}56 class={cn(57 "mb-1.5 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base",58 local.class,59 )}60 {...others}61 />62 );63};6465type FieldGroupProps<T extends ValidComponent = "div"> = ComponentProps<T> & {66 class?: string | undefined;67};6869const FieldGroup = <T extends ValidComponent = "div">(70 props: PolymorphicProps<T, FieldGroupProps<T>>,71) => {72 const [local, others] = splitProps(props as FieldGroupProps, ["class"]);7374 return (75 <Polymorphic<FieldGroupProps>76 as="div"77 data-slot="field-group"78 class={cn(79 "@container/field-group gap-5 *:data-[slot=field-group]:gap-4 data-[slot=checkbox-group]:gap-3 group/field-group flex w-full flex-col",80 local.class,81 )}82 {...others}83 />84 );85};8687const fieldVariants = cva(88 "gap-2 data-[invalid=true]:text-destructive group/field flex w-full",89 {90 variants: {91 orientation: {92// … truncated
What it pulls in
npm packages
Other registry items
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 |
