Inputs
Native Select
A dropdown in a border of its own: the system opens the list, so on a phone it is the familiar wheel rather than a homemade menu. The arrow is drawn in CSS.
- select
- dropdown
- form
- native
Preview
Use it with AI
- 1. Copy the link.
- 2. Write to your agent in your own words and drop the link into the sentence.
- 3. The agent opens the link and installs the component from the registry.
put this in the header: https://vibeui.ru/c/select-001?lang=en
Show the full instructions
What the link says, spelled out. Use it when your agent cannot open links — paste this text instead.
# Install and place "select-001" (Native Select) from VibeUI
## 1. Install first — do not skip, do not recreate
Run this exact command before writing any code:
npx shadcn@latest add https://vibeui.ru/r/select-001.json
Registry item: https://vibeui.ru/r/select-001.json
Installs to: components/vibeui/select-001.tsx (the exact path follows this project's components.json aliases).
npm dependencies: none.
Registry dependencies: none.
Install it from the registry. Do not recreate it from the description,
do not substitute a similar component from another library, and do not
rewrite it to match the project's existing style.
## 2. What it is
A dropdown in a border of its own: the system opens the list, so on a phone it is the familiar wheel rather than a homemade menu. The arrow is drawn in CSS.
A dropdown built on a native <select>: the border, sizing and arrow are ours, the list itself is opened by the operating system. That comes with free keyboard support, type-ahead, correct phone behaviour and form participation. Two sizes, a placeholder option and a disabled state. Zero dependencies, one file, its own palette.
## 3. How to use it
import { Select001 } from "@/components/vibeui/select-001"
<Select001
id="project"
name="project"
label="Project type"
options={[
{ value: "landing", label: "Landing page" },
{ value: "shop", label: "Online store" },
]}
/>
Read the installed file for the full prop list.
## 4. Where to place it
This is a small inline component. Put it exactly where the user asked,
inside the existing markup. Do not create a new page, section or
wrapper for it. If a similar control already sits in that spot,
replace it instead of adding a second one.
Placement: ___
(The user fills this line in. If it is still blank, ask where to put it
instead of guessing.)
## 5. Keep exactly as installed
- the local --vibeui-select-001-* palette — do not swap it for your theme tokens (bg-background, border-input and the like)
- the native <select> inside: replacing it with a list of divs gives up keyboard support, type-ahead and the native look on phones
- appearance:none together with the right padding that reserves room for the arrow: without it the value slides underneath
- the arrow made of two borders rotated 45° and its colour change on focus — no icon library is needed for it
- the box-shadow focus ring and the border colour change: the list opens from the keyboard, so focus must be visible
- the placeholder as the first option with an empty value and the disabled attribute — otherwise it can be submitted as a value
- the <style> block inside the component — it holds the palette, the sizes and the arrow
## 6. You may change
- the options array and its copy, plus the label and placeholder
- size: md inside a form, lg for a field standing on its own
- the accent through the accent prop — it colours the border, ring and arrow on focus
- any native select props: name, value, defaultValue, onChange, required, multiple, disabled
- width and outer spacing through className — by default the field fills its parent
## 7. Rules
- Do not turn this into a searchable combobox: a native select has no filter. Search needs its own component.
- The open list is drawn by the operating system and cannot be styled — that is the price of native behaviour.
- id is what links the label to the field. Without it, clicking the label does not open the list.
- Do not lift the CSS variables into globals.css: the component has to stay a single file.
## 8. Verify
- it renders with no console errors;
- it looks like the preview on the VibeUI page you copied this from;
- if it does not, you changed something listed in section 5 — put it back.For developers
npx shadcn@latest add https://vibeui.ru/r/select-001.jsonhttps://vibeui.ru/r/select-001.jsonКомпонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-select-001-*. Внутри нативный <select> с appearance:none: рамка, типографика и стрелка наши, список рисует операционная система. Стрелка — две грани квадрата, повёрнутые на 45°, иконочная библиотека не нужна. Варианты передаются массивом options; заглушка placeholder добавляется первым disabled-вариантом с пустым значением.
Component source
The same file your agent installs. Here in case you would rather copy it by hand.
import type { ComponentPropsWithoutRef, CSSProperties } from "react"
export type Select001Option = {
value: string
label: string
}
export type Select001Props = Omit<
ComponentPropsWithoutRef<"select">,
"size" | "children"
> & {
label?: string
options?: Select001Option[]
/** Первая строка-заглушка. Пустая строка убирает её. */
placeholder?: string
size?: "md" | "lg"
accent?: string
}
// Идея компонента: нативный <select> с одетой рамкой. Список открывает
// система, поэтому на телефоне это привычное колесо, а не самодельное меню,
// которое ломает прокрутку и клавиатуру. От нас — только рамка и стрелка.
const STYLES = `
:where([data-vibeui-block="select-001"]){
--vibeui-select-001-surface:oklch(1 0 0);
--vibeui-select-001-surface-border:oklch(0.91 0.006 265);
--vibeui-select-001-fg:oklch(0.24 0.016 265);
--vibeui-select-001-muted:oklch(0.54 0.014 265);
--vibeui-select-001-bg:oklch(1 0 0);
--vibeui-select-001-border:oklch(0.87 0.008 265);
--vibeui-select-001-accent:oklch(0.55 0.2 262);
--vibeui-select-001-radius:0.625rem;
--vibeui-select-001-height:2.75rem;
--vibeui-select-001-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
/* Собственная подложка: подпись поля — это текст, и на тёмной странице
он обязан читаться без правки палитры проекта. */
[data-vibeui-block="select-001"]{
box-sizing:border-box;padding:0.875rem;
background:var(--vibeui-select-001-surface);
border:1px solid var(--vibeui-select-001-surface-border);border-radius:0.875rem;
display:flex;flex-direction:column;gap:0.375rem;
font-family:var(--vibeui-select-001-font);color:var(--vibeui-select-001-fg);
}
[data-vibeui-block="select-001"][data-size="lg"]{--vibeui-select-001-height:3.25rem}
[data-vibeui-block="select-001"] [data-part="label"]{font-size:0.8125rem;font-weight:500}
[data-vibeui-block="select-001"] [data-part="field"]{position:relative;display:block}
[data-vibeui-block="select-001"] select{
appearance:none;-webkit-appearance:none;
width:100%;box-sizing:border-box;margin:0;
height:var(--vibeui-select-001-height);
padding:0 2.5rem 0 0.875rem;
border:1px solid var(--vibeui-select-001-border);
border-radius:var(--vibeui-select-001-radius);
background:var(--vibeui-select-001-bg);color:inherit;
font:inherit;font-size:0.9375rem;line-height:1.2;cursor:pointer;
transition:border-color .16s ease,box-shadow .16s ease;
}
[data-vibeui-block="select-001"] select:hover:not(:disabled):not(:focus){border-color:var(--vibeui-select-001-muted)}
[data-vibeui-block="select-001"] select:focus{
outline:none;border-color:var(--vibeui-select-001-accent);
box-shadow:0 0 0 3px color-mix(in oklab,var(--vibeui-select-001-accent) 22%,transparent);
}
[data-vibeui-block="select-001"] select:disabled{
cursor:not-allowed;opacity:.55;
background:color-mix(in oklab,var(--vibeui-select-001-border) 25%,var(--vibeui-select-001-bg));
}
/* Стрелка нарисована двумя гранями квадрата: иконочная библиотека не нужна. */
[data-vibeui-block="select-001"] [data-part="arrow"]{
position:absolute;right:1rem;top:50%;
width:0.4375rem;height:0.4375rem;
margin-top:-0.3125rem;pointer-events:none;
border-right:1.5px solid var(--vibeui-select-001-muted);
border-bottom:1.5px solid var(--vibeui-select-001-muted);
transform:rotate(45deg);
transition:border-color .16s ease;
}
[data-vibeui-block="select-001"] select:focus + [data-part="arrow"]{
border-right-color:var(--vibeui-select-001-accent);
border-bottom-color:var(--vibeui-select-001-accent);
}
[data-vibeui-block="select-001"] [data-part="placeholder"]{color:var(--vibeui-select-001-muted)}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="select-001"] *{animation:none!important;transition:none!important}}
`
const DEFAULT_OPTIONS: Select001Option[] = [
{ value: "landing", label: "Лендинг" },
{ value: "dashboard", label: "Личный кабинет" },
{ value: "shop", label: "Интернет-магазин" },
{ value: "blog", label: "Блог" },
]
/**
* Нативный select в собственной рамке: системный список, своя типографика.
* Один файл, ноль зависимостей, собственная палитра.
*/
export function Select001({
label = "Тип проекта",
options = DEFAULT_OPTIONS,
placeholder = "Выберите вариант",
size = "md",
accent,
id,
className,
style,
defaultValue,
...props
}: Select001Props) {
const palette = {
...(accent ? { "--vibeui-select-001-accent": accent } : null),
...style,
} as CSSProperties
return (
<>
<style href="vibeui-select-001" precedence="medium">
{STYLES}
</style>
<div
data-vibeui-block="select-001"
data-size={size}
className={className}
style={palette}
>
{label ? (
<label data-part="label" htmlFor={id}>
{label}
</label>
) : null}
<span data-part="field">
<select
{...props}
id={id}
defaultValue={defaultValue ?? (placeholder ? "" : undefined)}
>
{placeholder ? (
<option data-part="placeholder" value="" disabled>
{placeholder}
</option>
) : null}
{options.map((option) => (
<option key={option.value} value={option.value}>
{option.label}
</option>
))}
</select>
<span data-part="arrow" aria-hidden="true" />
</span>
</div>
</>
)
}