{
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
"name": "field-example",
"title": "Field",
"registryDependencies": [
"badge",
"checkbox",
"field",
"input",
"input-otp",
"native-select",
"radio-group",
"select",
"slider",
"switch",
"textarea",
"example"
],
"files": [
{
"path": "registry/radix-vega/examples/field-example.tsx",
"content": "\"use client\"\n\nimport { useState } from \"react\"\nimport { REGEXP_ONLY_DIGITS } from \"input-otp\"\n\nimport {\n Example,\n ExampleWrapper,\n} from \"@/registry/radix-vega/components/example\"\nimport { Badge } from \"@/registry/radix-vega/ui/badge\"\nimport { Checkbox } from \"@/registry/radix-vega/ui/checkbox\"\nimport {\n Field,\n FieldContent,\n FieldDescription,\n FieldGroup,\n FieldLabel,\n FieldLegend,\n FieldSet,\n FieldTitle,\n} from \"@/registry/radix-vega/ui/field\"\nimport { Input } from \"@/registry/radix-vega/ui/input\"\nimport {\n InputOTP,\n InputOTPGroup,\n InputOTPSeparator,\n InputOTPSlot,\n} from \"@/registry/radix-vega/ui/input-otp\"\nimport {\n NativeSelect,\n NativeSelectOptGroup,\n NativeSelectOption,\n} from \"@/registry/radix-vega/ui/native-select\"\nimport {\n RadioGroup,\n RadioGroupItem,\n} from \"@/registry/radix-vega/ui/radio-group\"\nimport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"@/registry/radix-vega/ui/select\"\nimport { Slider } from \"@/registry/radix-vega/ui/slider\"\nimport { Switch } from \"@/registry/radix-vega/ui/switch\"\nimport { Textarea } from \"@/registry/radix-vega/ui/textarea\"\n\nexport default function FieldExample() {\n return (\n \n \n \n \n \n \n \n \n \n \n \n \n )\n}\n\nfunction InputFields() {\n return (\n \n \n \n Basic Input\n \n \n \n \n Input with Description\n \n \n \n Choose a unique username for your account.\n \n \n \n Email Address\n \n We'll never share your email with anyone.\n \n \n \n \n \n Required Field *\n \n \n This field must be filled out.\n \n \n Disabled Input\n \n This field is currently disabled.\n \n \n \n Input with Badge{\" \"}\n \n Recommended\n \n \n \n \n \n Invalid Input\n \n \n This field contains validation errors.\n \n \n \n Disabled Field\n \n This field is currently disabled.\n \n \n \n )\n}\n\nfunction TextareaFields() {\n return (\n \n \n \n Basic Textarea\n \n \n \n Comments\n \n Maximum 500 characters allowed.\n \n \n Bio\n \n Tell us about yourself in a few sentences.\n \n \n \n \n Message\n \n \n Enter your message so it is long enough to test the layout.\n \n \n \n Invalid Textarea\n \n \n This field contains validation errors.\n \n \n \n \n Disabled Field\n \n \n This field is currently disabled.\n \n \n \n )\n}\n\nfunction SelectFields() {\n return (\n \n \n \n Basic Select\n \n \n \n Country\n \n \n Select the country where you currently reside.\n \n \n \n Timezone\n \n Choose your local timezone for accurate scheduling.\n \n \n \n \n Invalid Select\n \n \n This field contains validation errors.\n \n \n \n \n Disabled Field\n \n \n This field is currently disabled.\n \n \n \n )\n}\n\nfunction NativeSelectFields() {\n return (\n \n \n \n \n Basic Native Select\n \n \n Choose an option\n Option 1\n Option 2\n Option 3\n \n \n \n Country\n \n \n Select your country\n \n United States\n United Kingdom\n Canada\n \n \n Select the country where you currently reside.\n \n \n \n Timezone\n \n Choose your local timezone for accurate scheduling.\n \n \n Select timezone\n UTC\n Eastern Time\n Pacific Time\n \n \n \n \n Grouped Options\n \n \n Select a region\n \n United States\n Canada\n Mexico\n \n \n United Kingdom\n France\n Germany\n \n \n \n Native select with grouped options using optgroup.\n \n \n \n \n Invalid Native Select\n \n \n \n This field has an error\n \n Option 1\n Option 2\n Option 3\n \n \n This field contains validation errors.\n \n \n \n \n Disabled Field\n \n \n Cannot select\n Option 1\n Option 2\n Option 3\n \n This field is currently disabled.\n \n \n \n )\n}\n\nfunction CheckboxFields() {\n return (\n \n \n \n \n \n I agree to the terms and conditions\n \n \n \n \n Accept terms and conditions\n \n \n \n \n \n \n \n Subscribe to newsletter\n \n \n Receive weekly updates about new features and promotions.\n \n \n \n \n \n \n \n Enable Touch ID\n \n Enable Touch ID to quickly unlock your device.\n \n \n \n \n \n \n \n \n Invalid checkbox\n \n \n \n \n \n Disabled checkbox\n \n \n \n \n )\n}\n\nfunction RadioFields() {\n return (\n \n \n \n \n \n \n \n \n Enable Touch ID\n \n Enable Touch ID to quickly unlock your device.\n \n \n \n \n \n \n \n Enable Touch ID and Face ID to make it even faster to unlock\n your device. This is a long label to test the layout.\n \n \n Enable Touch ID to quickly unlock your device.\n \n \n \n \n \n \n \n \n \n Enable Touch ID\n \n Enable Touch ID to quickly unlock your device.\n \n \n \n \n \n \n \n \n \n Enable Touch ID and Face ID to make it even faster to unlock\n your device. This is a long label to test the layout.\n \n \n Enable Touch ID to quickly unlock your device.\n \n \n \n \n \n \n \n \n \n )\n}\n\nfunction SwitchFields() {\n return (\n \n \n \n \n Airplane Mode\n \n Turn on airplane mode to disable all connections.\n \n \n \n \n \n Dark Mode\n \n \n \n \n \n Marketing Emails\n \n Receive emails about new products, features, and more.\n \n \n \n \n Privacy Settings\n Manage your privacy preferences.\n \n \n \n \n Make profile visible to others\n \n \n \n \n \n \n \n Show email on profile\n \n \n \n \n \n \n Invalid Switch\n \n This switch has validation errors.\n \n \n \n \n \n \n \n Disabled Switch\n \n \n This switch is currently disabled.\n \n \n \n \n \n \n )\n}\n\nfunction SliderFields() {\n const [volume, setVolume] = useState([50])\n const [brightness, setBrightness] = useState([75])\n const [temperature, setTemperature] = useState([0.3, 0.7])\n const [priceRange, setPriceRange] = useState([25, 75])\n const [colorBalance, setColorBalance] = useState([10, 20, 70])\n\n return (\n \n \n \n Volume\n \n \n \n Screen Brightness\n \n \n Current brightness: {brightness[0]}%\n \n \n \n Video Quality\n \n Higher quality uses more bandwidth.\n \n \n \n \n \n Temperature Range\n \n \n \n Range: {temperature[0].toFixed(1)} - {temperature[1].toFixed(1)}\n \n \n \n Price Range\n \n \n ${priceRange[0]} - ${priceRange[1]}\n \n \n \n Color Balance\n \n \n Red: {colorBalance[0]}%, Green: {colorBalance[1]}%, Blue:{\" \"}\n {colorBalance[2]}%\n \n \n \n Invalid Slider\n \n \n This slider has validation errors.\n \n \n \n \n Disabled Slider\n \n \n \n This slider is currently disabled.\n \n \n \n \n )\n}\n\nfunction InputOTPFields() {\n const [value, setValue] = useState(\"\")\n const [pinValue, setPinValue] = useState(\"\")\n\n return (\n \n \n \n Verification Code\n \n \n \n \n \n \n \n \n \n \n \n \n Enter OTP\n \n \n \n \n \n \n \n \n \n \n \n Enter the 6-digit code sent to your email.\n \n \n \n \n Two-Factor Authentication\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n Enter the code from your authenticator app.\n \n \n \n PIN Code\n \n \n \n \n \n \n \n \n \n Enter your 4-digit PIN (numbers only).\n \n \n \n Invalid OTP\n \n \n \n \n \n \n \n \n \n \n \n This OTP field contains validation errors.\n \n \n \n Disabled OTP\n \n \n \n \n \n \n \n \n \n \n \n This OTP field is currently disabled.\n \n \n \n \n )\n}\n\nfunction HorizontalFields() {\n return (\n \n \n \n \n Username\n Enter your preferred username.\n \n \n \n \n \n Bio\n \n Write a short description about yourself.\n \n \n \n \n \n \n \n Email Notifications\n \n \n Receive email updates about your account.\n \n \n \n \n \n \n Favorite Fruit\n Choose your favorite fruit.\n \n \n \n \n \n Country\n Select your country.\n \n \n Select a country\n United States\n United Kingdom\n Canada\n \n \n \n \n Volume\n Adjust the volume level.\n \n \n \n \n \n )\n}\n",
"type": "registry:example"
}
],
"type": "registry:example"
}