DOCS
v0.4

Components / Select

Select

Dropdown select with optional search filtering, keyboard navigation (arrows/enter/escape), size variants, rounded options, and validation states.

formsv0.1.0

Playground

Examples

Basic
<cg-select placeholder="Choose a model" style="max-width: 300px;"></cg-select>
Sizes
<cg-stack gap="sm" style="max-width: 300px;"><cg-select size="sm" placeholder="Small"></cg-select><cg-select size="md" placeholder="Medium (default)"></cg-select><cg-select size="lg" placeholder="Large"></cg-select></cg-stack>
Searchable
<cg-select searchable placeholder="Search countries..." style="max-width: 300px;"></cg-select>
Error state
<cg-select error placeholder="Required field" style="max-width: 300px;"></cg-select>

Import

import { CgSelect } from '@cognivo/components';
// Or tree-shake: import '@cognivo/components/cg-select';

Per-component imports ship only that component (~8 kB gzip).

API Reference

PropTypeDefaultDescription
optionsSelectOption[]Array of {value, label, disabled?} objects
valuestring""Selected value
labelstringLabel text above the trigger
placeholderstring"Select..."Placeholder text
namestring""Form field name
size"sm" | "md" | "lg""md"Select trigger size
rounded"none" | "sm" | "md" | "lg" | "full""lg"Border radius override
disabledbooleanfalseDisable interaction
errorbooleanfalseError state — red border and focus ring
successbooleanfalseSuccess state — green border and focus ring
searchablebooleanfalseEnable search filtering within the dropdown

Events

EventDetailDescription
cg-change{value: string, label: string}When a selection is made