Select Validation

PreviousNext

select-validation-demo

Docs
intentuipage

Preview

Loading preview…
components/docs/pickers/select/select-validation-demo.tsx
"use client"

import { Form } from "react-aria-components"
import { Button } from "@/components/ui/button"
import { Label } from "@/components/ui/field"
import { Select, SelectContent, SelectItem, SelectTrigger } from "@/components/ui/select"

const software = [
  { id: 1, name: "Adobe Photoshop" },
  //...
]

export default function SelectValidationDemo() {
  return (
    <Form onSubmit={(e) => e.preventDefault()} className="space-y-2">
      <Select placeholder="Select a software" isRequired>
        <Label>Design software</Label>
        <SelectTrigger />
        <SelectContent items={software}>
          {(item) => (
            <SelectItem id={item.id} textValue={item.name}>
              {item.name}
            </SelectItem>
          )}
        </SelectContent>
      </Select>
      <Button type="submit">Submit</Button>
    </Form>
  )
}

Installation

npx shadcn@latest add @intentui/select-validation-demo

Usage

Usage varies by registry entry. Refer to the registry docs or source files below for details.