Note: This project is still in development and has not been publicly released. Coming soon.
Docs
Select Input
Select Input

A versatile dropdown select component with pill variant support, validation, and Zod integration for efficient option selection.

18 views
2 downloads
Loading...

Overview

The Select Input component delivers an intuitive dropdown selection experience with both default and pill variants, making it essential for forms requiring single-option choices from larger datasets. It features native and custom dropdown implementations, comprehensive validation, and accessibility support. Perfect for category selections, filtering interfaces, and any scenario where users need to choose from multiple predefined options.

Installation

pnpm dlx shadcn@latest add https://deltacomponents.dev/r/select-input.json

Usage

1"use client"
2
3import { SelectInput } from "@/registry/inputs/select-input"
4
5export function Component() {
6 const options = [
7 { value: "starter", label: "Starter Plan" },
8 { value: "professional", label: "Professional Plan" },
9 { value: "enterprise", label: "Enterprise Plan" },
10 ]
11
12 return (
13 <SelectInput
14 label="Subscription Plan"
15 name="plan"
16 options={options}
17 placeholder="Choose your plan"
18 required
19 onValueChange={(value) => console.log("Selected:", value)}
20 />
21 )
22}

API Reference

Props

PropTypeDefaultDescription
labelstring-Label for the select field (required)
namestring-Name of the select field for form submission (required)
optionsSelectOption[]-Options for the dropdown (required)
descriptionstringundefinedDescription text below the label
hintstringundefinedHint text below the select
errorstringundefinedError message to display
requiredbooleanfalseWhether the field is required
pendingbooleanfalseWhether the field is in a loading state
defaultValuestringundefinedDefault selected value
valuestringundefinedControlled selected value
placeholderstring"Select an option"Placeholder text when no option is selected
disabledbooleanfalseWhether the select is disabled
idstringnameID for the select element
variant"default" | "pill""default"Visual variant of the select
coloredBorderbooleanfalseWhether to show colored border (pill variant)
labelVariant"default" | "muted""default"Label text styling variant
containerClassNamestring""CSS classes for the container
selectClassNamestring""CSS classes for the select trigger
labelClassNamestring""CSS classes for the label
schemaZodType<string>undefinedZod schema for validation
onValidate(isValid: boolean, value: string, error?: string) => voidundefinedValidation callback
onValueChange(value: string) => voidundefinedCallback when selection changes

SelectOption Interface

1interface SelectOption {
2 value: string
3 label: string
4 disabled?: boolean
5}

Examples

Pill Variant

Rounded pill variant with muted background styling for modern form interfaces.

Loading...