mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-06-26 22:26:05 +00:00
* feat: init * fix * fix * fix * feat * feat * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * feat: implement icons * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * feat: update init command * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * feat: dialog * feat * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * feat: add registry:base item type * feat: rename frame to canva * fix * feat * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fi * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * feat: add all colors * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * fix * feat: add outfit font * fix * fix * fix * fix * fix * chore: changeset * fix * fix * fix * fix * fix * fix * fix * fix
130 lines
4.4 KiB
TypeScript
130 lines
4.4 KiB
TypeScript
import {
|
|
Example,
|
|
ExampleWrapper,
|
|
} from "@/registry/bases/base/components/example"
|
|
import {
|
|
Field,
|
|
FieldDescription,
|
|
FieldLabel,
|
|
} from "@/registry/bases/base/ui/field"
|
|
import {
|
|
NativeSelect,
|
|
NativeSelectOptGroup,
|
|
NativeSelectOption,
|
|
} from "@/registry/bases/base/ui/native-select"
|
|
|
|
export default function NativeSelectExample() {
|
|
return (
|
|
<ExampleWrapper>
|
|
<NativeSelectBasic />
|
|
<NativeSelectWithGroups />
|
|
<NativeSelectSizes />
|
|
<NativeSelectWithField />
|
|
<NativeSelectDisabled />
|
|
<NativeSelectInvalid />
|
|
</ExampleWrapper>
|
|
)
|
|
}
|
|
|
|
function NativeSelectBasic() {
|
|
return (
|
|
<Example title="Basic">
|
|
<NativeSelect>
|
|
<NativeSelectOption value="">Select a fruit</NativeSelectOption>
|
|
<NativeSelectOption value="apple">Apple</NativeSelectOption>
|
|
<NativeSelectOption value="banana">Banana</NativeSelectOption>
|
|
<NativeSelectOption value="blueberry">Blueberry</NativeSelectOption>
|
|
<NativeSelectOption value="grapes" disabled>
|
|
Grapes
|
|
</NativeSelectOption>
|
|
<NativeSelectOption value="pineapple">Pineapple</NativeSelectOption>
|
|
</NativeSelect>
|
|
</Example>
|
|
)
|
|
}
|
|
|
|
function NativeSelectWithGroups() {
|
|
return (
|
|
<Example title="With Groups">
|
|
<NativeSelect>
|
|
<NativeSelectOption value="">Select a food</NativeSelectOption>
|
|
<NativeSelectOptGroup label="Fruits">
|
|
<NativeSelectOption value="apple">Apple</NativeSelectOption>
|
|
<NativeSelectOption value="banana">Banana</NativeSelectOption>
|
|
<NativeSelectOption value="blueberry">Blueberry</NativeSelectOption>
|
|
</NativeSelectOptGroup>
|
|
<NativeSelectOptGroup label="Vegetables">
|
|
<NativeSelectOption value="carrot">Carrot</NativeSelectOption>
|
|
<NativeSelectOption value="broccoli">Broccoli</NativeSelectOption>
|
|
<NativeSelectOption value="spinach">Spinach</NativeSelectOption>
|
|
</NativeSelectOptGroup>
|
|
</NativeSelect>
|
|
</Example>
|
|
)
|
|
}
|
|
|
|
function NativeSelectSizes() {
|
|
return (
|
|
<Example title="Sizes">
|
|
<div className="flex flex-col gap-4">
|
|
<NativeSelect size="sm">
|
|
<NativeSelectOption value="">Select a fruit</NativeSelectOption>
|
|
<NativeSelectOption value="apple">Apple</NativeSelectOption>
|
|
<NativeSelectOption value="banana">Banana</NativeSelectOption>
|
|
<NativeSelectOption value="blueberry">Blueberry</NativeSelectOption>
|
|
</NativeSelect>
|
|
<NativeSelect size="default">
|
|
<NativeSelectOption value="">Select a fruit</NativeSelectOption>
|
|
<NativeSelectOption value="apple">Apple</NativeSelectOption>
|
|
<NativeSelectOption value="banana">Banana</NativeSelectOption>
|
|
<NativeSelectOption value="blueberry">Blueberry</NativeSelectOption>
|
|
</NativeSelect>
|
|
</div>
|
|
</Example>
|
|
)
|
|
}
|
|
|
|
function NativeSelectWithField() {
|
|
return (
|
|
<Example title="With Field">
|
|
<Field>
|
|
<FieldLabel htmlFor="native-select-country">Country</FieldLabel>
|
|
<NativeSelect id="native-select-country">
|
|
<NativeSelectOption value="">Select a country</NativeSelectOption>
|
|
<NativeSelectOption value="us">United States</NativeSelectOption>
|
|
<NativeSelectOption value="uk">United Kingdom</NativeSelectOption>
|
|
<NativeSelectOption value="ca">Canada</NativeSelectOption>
|
|
<NativeSelectOption value="au">Australia</NativeSelectOption>
|
|
</NativeSelect>
|
|
<FieldDescription>Select your country of residence.</FieldDescription>
|
|
</Field>
|
|
</Example>
|
|
)
|
|
}
|
|
|
|
function NativeSelectDisabled() {
|
|
return (
|
|
<Example title="Disabled">
|
|
<NativeSelect disabled>
|
|
<NativeSelectOption value="">Disabled</NativeSelectOption>
|
|
<NativeSelectOption value="apple">Apple</NativeSelectOption>
|
|
<NativeSelectOption value="banana">Banana</NativeSelectOption>
|
|
<NativeSelectOption value="blueberry">Blueberry</NativeSelectOption>
|
|
</NativeSelect>
|
|
</Example>
|
|
)
|
|
}
|
|
|
|
function NativeSelectInvalid() {
|
|
return (
|
|
<Example title="Invalid">
|
|
<NativeSelect aria-invalid="true">
|
|
<NativeSelectOption value="">Error state</NativeSelectOption>
|
|
<NativeSelectOption value="apple">Apple</NativeSelectOption>
|
|
<NativeSelectOption value="banana">Banana</NativeSelectOption>
|
|
<NativeSelectOption value="blueberry">Blueberry</NativeSelectOption>
|
|
</NativeSelect>
|
|
</Example>
|
|
)
|
|
}
|