field
vengenceui/fieldFreeComponent
vengenceui publishes no description for this item.
Live preview
live · rendered by the registry
Rendered by vengenceui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://www.vengenceui.com/r/field.jsonSource
1"use client"23import { useMemo } from "react"4import { cva, type VariantProps } from "class-variance-authority"56import { cn } from "@/lib/utils"7import { Label } from "@/components/ui/label"8import { Separator } from "@/components/ui/separator"910function FieldSet({ className, ...props }: React.ComponentProps<"fieldset">) {11 return (12 <fieldset13 data-slot="field-set"14 className={cn(15 "flex flex-col gap-6",16 "has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",17 className18 )}19 {...props}20 />21 )22}2324function FieldLegend({25 className,26 variant = "legend",27 ...props28}: React.ComponentProps<"legend"> & { variant?: "legend" | "label" }) {29 return (30 <legend31 data-slot="field-legend"32 data-variant={variant}33 className={cn(34 "mb-3 font-medium",35 "data-[variant=legend]:text-base",36 "data-[variant=label]:text-sm",37 className38 )}39 {...props}40 />41 )42}4344function FieldGroup({ className, ...props }: React.ComponentProps<"div">) {45 return (46 <div47 data-slot="field-group"48 className={cn(49 "group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4",50 className51 )}52 {...props}53 />54 )55}5657const fieldVariants = cva(58 "group/field flex w-full gap-3 data-[invalid=true]:text-destructive",59 {60 variants: {61 orientation: {62 vertical: ["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],63 horizontal: [64 "flex-row items-center",65 "[&>[data-slot=field-label]]:flex-auto",66 "has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",67 ],68 responsive: [69 "flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto",70 "@md/field-group:[&>[data-slot=field-label]]:flex-auto",71 "@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",72 ],73 },74 },75 defaultVariants: {76 orientation: "vertical",77 },78 }79)8081function Field({82 className,83 orientation = "vertical",84 ...props85}: React.ComponentProps<"div"> & VariantProps<typeof fieldVariants>) {86 return (87 <div88 role="group"89 data-slot="field"90// … truncated
Files it writes
More from vengenceui
All 128 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| accordionaccordion | vengenceui | Components | Free | 2 deps | |
| agent-bento-gridagent-bento-grid | vengenceui | Components | Free | 1 dep | |
| alertalert | vengenceui | Components | Free | no deps | |
| animated-buttonanimated-button | vengenceui | Components | Free | 1 dep | |
| animated-footeranimated-footer | vengenceui | Components | Free | 2 deps | |
| animated-numberanimated-number | vengenceui | Components | Free | 1 dep | |
| animated-raysanimated-rays | vengenceui | Components | Free | no deps | |
| animated-tooltipanimated-tooltip | vengenceui | Components | Free | 1 dep |
