UNPKG

dgz-ui-shared

Version:

Custom ui library using React.js, Shadcn/ui, TailwindCSS, Typescript, dgz-ui library

39 lines 2.05 kB
import { FormItemProps, Option } from 'dgz-ui/form'; import { FieldValues } from 'react-hook-form'; /** * Props for the MyShadcnSelect component. * @template TFieldValues - The type of the form values. */ export type MyShadcnSelectProps<TFieldValues extends FieldValues> = FormItemProps<TFieldValues> & { /** Array of options to display in the select dropdown. */ options?: Option[]; /** Placeholder text when no option is selected. */ placeholder?: string; /** Additional CSS classes. */ className?: string; /** Whether the select is disabled. */ disabled?: boolean; /** Callback fired when the selected value changes. */ onChange?: (value: string | number) => void; /** Whether the field is required. */ required?: boolean; }; /** * MyShadcnSelect is a native Shadcn select component integrated with react-hook-form. * Renders a dropdown select with customizable options and validation support. * * @template TFieldValues - Form values type used by react-hook-form. * @param control - The `react-hook-form` control object. * @param name - The name of the field in `react-hook-form`. * @param label - The label to display for the select. * @param required - Whether the field is required. * @param className - Additional CSS classes. * @param rules - The `react-hook-form` validation rules. * @param options - Array of options to display in the select dropdown. * @param placeholder - Placeholder text when no option is selected. * @param disabled - Whether the select is disabled. * @param onChange - Callback fired when the selected value changes. * @returns {JSX.Element | false} A select component integrated with react-hook-form, or false if name/control are missing */ export declare const MyShadcnSelect: <TFieldValues extends FieldValues>({ control, name, label, required, className, rules, options, placeholder, disabled, onChange, }: MyShadcnSelectProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element | undefined; //# sourceMappingURL=MyShadcnSelect.d.ts.map