Select component allows users to select a single option from a dropdown list. It offers advanced features like search, loading, validation, and different visual variants. It's ideal for cases where a single selection is needed.tsx
import { Select } from "@arkyn/components";
name and options properties. Options must be an array of objects with label and value.Selecione...
tsx
<Selectname="basic-select"options={[{ label: "JavaScript", value: "js" },{ label: "TypeScript", value: "ts" },{ label: "Python", value: "python" },{ label: "Java", value: "java" },]}/>
md and lg, with md being the default.Selecione...
Selecione...
tsx
<Selectname="select-md"label="Medium size"size="md"options={[{ label: "Option 1", value: "opt1" },{ label: "Option 2", value: "opt2" },{ label: "Option 3", value: "opt3" }]}/><Selectname="select-lg"label="Large size"size="lg"options={[{ label: "Option 1", value: "opt1" },{ label: "Option 2", value: "opt2" },{ label: "Option 3", value: "opt3" }]}/>
solid, outline and underline, providing different visual styles.Selecione...
Selecione...
Selecione...
tsx
<Selectname="select-solid"label="Solid variant"variant="solid"options={[{ label: "Design", value: "design" },{ label: "Frontend", value: "frontend" },{ label: "Backend", value: "backend" }]}/><Selectname="select-outline"label="Outline variant"variant="outline"options={[{ label: "Design", value: "design" },{ label: "Frontend", value: "frontend" },{ label: "Backend", value: "backend" }]}/><Selectname="select-underline"label="Underline variant"variant="underline"options={[{ label: "Design", value: "design" },{ label: "Frontend", value: "frontend" },{ label: "Backend", value: "backend" }]}/>
Selecione...
tsx
<Selectname="select-with-icon"label="Technologies"leftIcon={Code}options={[{ label: "React", value: "react" },{ label: "Vue", value: "vue" },{ label: "Angular", value: "angular" },{ label: "Svelte", value: "svelte" },]}/>
Dept:
Selecione...
tsx
<Selectname="select-prefix-text"label="Departments"prefix="Dept:"options={[{ label: "Human Resources", value: "hr" },{ label: "Technology", value: "tech" },{ label: "Marketing", value: "marketing" },{ label: "Sales", value: "sales" },]}/>
isSearchable to facilitate selection in large lists.Search and select a city...
tsx
<Selectname="searchable-select"label="Cities"isSearchableplaceholder="Search and select a city..."notFoundText="No cities found"leftIcon={MapPin}options={[{ label: "New York", value: "ny" },{ label: "Los Angeles", value: "la" },{ label: "Chicago", value: "chicago" },{ label: "Houston", value: "houston" },{ label: "Phoenix", value: "phoenix" },{ label: "Philadelphia", value: "philadelphia" },{ label: "San Antonio", value: "sanantonio" },{ label: "San Diego", value: "sandiego" },]}/>
defaultValue to pre-select a specific option.JavaScript
tsx
<Selectname="default-value"label="Programming Language"defaultValue="js"leftIcon={Code}options={[{ label: "JavaScript", value: "js" },{ label: "TypeScript", value: "ts" },{ label: "React", value: "react" },{ label: "Vue", value: "vue" },{ label: "Node.js", value: "node" },{ label: "Python", value: "python" },]}/>
closeOnSelect.Selecione...
Selecione...
tsx
<Selectname="close-on-select"label="Language (closes on select)"closeOnSelect={true}leftIcon={Code}options={[{ label: "React", value: "react" },{ label: "JavaScript", value: "js" },{ label: "CSS", value: "css" },{ label: "HTML", value: "html" }]}/><Selectname="keep-open"label="Category (keeps open)"closeOnSelect={false}leftIcon={Tag}options={[{ label: "Frontend", value: "frontend" },{ label: "Backend", value: "backend" },{ label: "DevOps", value: "devops" },{ label: "Mobile", value: "mobile" }]}/>
Option 1
tsx
<Selectname="disabled-select"label="Disabled selection"disableddefaultValue="opt1"options={[{ label: "Option 1", value: "opt1" },{ label: "Option 2", value: "opt2" },{ label: "Option 3", value: "opt3" },]}/>
Frontend
tsx
<Selectname="readonly-select"label="Read only"readOnlydefaultValue="frontend"options={[{ label: "Frontend", value: "frontend" },{ label: "Backend", value: "backend" },{ label: "Mobile", value: "mobile" },{ label: "DevOps", value: "devops" },]}/>
leftIcon.Selecione...
tsx
<Selectname="loading-select"label="Loading options..."isLoadingoptions={[]}/>
errorMessage property, it will take precedence over messages from the form provider.Selecione...
tsx
<Selectname="required-select"label="Required Skill"showAsteriskerrorMessage="Please select a skill"leftIcon={Code}options={[{ label: "JavaScript", value: "js" },{ label: "TypeScript", value: "ts" },{ label: "React", value: "react" },{ label: "Vue", value: "vue" },]}/>
name - string (required)
Name of the field for form manipulationoptions - { label: string; value: string }[] (required)
Array of options with label and valueid - string
Optional unique identifier for the componentvalue - string
Controlled value - selected option valuedefaultValue - string (default: "")
Default value selected for uncontrolled useshowAsterisk - boolean
Whether to show an asterisk in the label for required fieldslabel - string
Label text to display above the selecterrorMessage - string
Error message to display below the selectplaceholder - string (default: "Selecione...")
Placeholder text when no option is selectednotFoundText - string (default: "Sem opções disponíveis")
Text displayed when no options match the searchclassName - string
Additional CSS classes for stylingdisabled - boolean (default: false)
If the select is disabledreadOnly - boolean (default: false)
If the select is read-onlyisLoading - boolean (default: false)
Controls the loading state with the spinnerisSearchable - boolean (default: false)
Whether the search functionality is supportedcloseOnSelect - boolean (default: true)
Whether the dropdown should close after selecting an optiononSearch - (value: string) => void
Callback function called when the search value changesonChange - (value: string) => void
Callback function called when the selected value changesonFocus - () => void
Callback function called when the select gains focusonBlur - (e: FocusEvent<HTMLDivElement>) => void
Callback function called when the select loses focussize - "md" | "lg" (default: "md")
Select sizevariant - "solid" | "outline" | "underline" (default: "solid")
Select visual variantprefix - string | LucideIcon
Text or icon to display at the beginning of the selectleftIcon - LucideIcon
Optional icon to display on the left sideoptionMaxHeight - number
Maximum height for the options dropdown{ label: string; value: string }[] where label is the displayed text and value is the internal value used by the form.onSearchOptions must always have a unique label and valueisSearchable enables local search by default; use onSearch for custom searchcloseOnSelect is true by default for single selection convenience