Native Select

Size Scale

A native select with an sm / md / lg size scale: three steps described by one set of rules and four geometry variables.

  • select
  • sizes
  • scale
  • tokens

Preview

1440pxHost theme

Use it with AI

  1. 1. Copy the link.
  2. 2. Write to your agent in your own words and drop the link into the sentence.
  3. 3. The agent opens the link and installs the component from the registry.

put this in the header: https://vibeui.ru/c/nativeselect-007?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 "nativeselect-007" (Size Scale) 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/nativeselect-007.json

Registry item: https://vibeui.ru/r/nativeselect-007.json
Installs to: components/vibeui/nativeselect-007.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 native select with an sm / md / lg size scale: three steps described by one set of rules and four geometry variables.

A native select in three sizes: geometry lives in variables and the step is chosen by a data-size attribute. Zero dependencies, one file, no client JS.

## 3. How to use it
import { Nativeselect007 } from "@/components/vibeui/nativeselect-007"

<Nativeselect007
  label="Package size"
  size="lg"
  options={["Envelope", "Box S", "Pallet"]}
/>

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-nativeselect-007-* palette — do not swap it for your theme tokens
- the four geometry variables instead of three rule sets: duplicated steps drift apart on the first edit
- the right-padding formula built from the padding and the arrow side — otherwise text slides under the arrow on the large step
- centering the arrow by half its own side: a fixed offset breaks as soon as the size changes
- the md height at no less than 2.5rem: that is the floor for comfortable finger targets
- the block's own light surface: without it the dark label disappears on a dark background

## 6. You may change
- the step through size, the field name through label and the choices through options
- the focus color through accent
- the step values in the height, text, padding and arrow variables
- the number of steps: adding xl is one more data-size block

## 7. Rules
- The sm step below 2rem is for a mouse, not a finger: keep md or larger on phones.
- Text under 16px makes iOS Safari zoom the page on focus: for mobile forms that argues for lg.
- Field size should follow screen density, not importance, or the form looks arbitrary.
- 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/nativeselect-007.json
https://vibeui.ru/r/nativeselect-007.json

Компонент самодостаточен: один файл, без зависимостей, палитра в локальных переменных --vibeui-nativeselect-007-*. Серверный: из хуков только useId. Размер выражен атрибутом data-size на корне, который переопределяет четыре переменные: высоту, кегль, отступ и сторону стрелки. Правила поля написаны один раз и читают эти переменные, поэтому новая ступень — это четыре строки, а не копия компонента. Правый отступ поля посчитан формулой из отступа и стороны стрелки, поэтому текст не заезжает под стрелку ни на одной ступени, а сама стрелка центрируется сдвигом на половину своей стороны.

Component source

The same file your agent installs. Here in case you would rather copy it by hand.

import { useId } from "react"
import type { ComponentPropsWithoutRef, CSSProperties } from "react"

export type Nativeselect007Props = Omit<
  ComponentPropsWithoutRef<"select">,
  "children" | "size"
> & {
  label?: string
  size?: "sm" | "md" | "lg"
  options?: string[]
  accent?: string
}

// Идея компонента: размер поля — это не три отдельных набора стилей.
// Все три ступени описаны одним набором правил, а data-size на корне
// переопределяет четыре переменные: высоту, кегль, отступ и величину
// стрелки. Добавить ступень — значит добавить четыре строки, а не копию
// компонента.
const STYLES = `
:where([data-vibeui-block="nativeselect-007"]){
--vibeui-nativeselect-007-surface:oklch(1 0 0);
--vibeui-nativeselect-007-surface-border:oklch(0.91 0.006 265);
--vibeui-nativeselect-007-fg:oklch(0.24 0.016 265);
--vibeui-nativeselect-007-muted:oklch(0.54 0.014 265);
--vibeui-nativeselect-007-field-border:oklch(0.85 0.01 265);
--vibeui-nativeselect-007-accent:oklch(0.58 0.16 300);
--vibeui-nativeselect-007-height:2.5rem;
--vibeui-nativeselect-007-text:0.9375rem;
--vibeui-nativeselect-007-pad:0.75rem;
--vibeui-nativeselect-007-arrow:0.4375rem;
--vibeui-nativeselect-007-radius:0.625rem;
--vibeui-nativeselect-007-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="nativeselect-007"][data-size="sm"]{
--vibeui-nativeselect-007-height:2rem;
--vibeui-nativeselect-007-text:0.8125rem;
--vibeui-nativeselect-007-pad:0.5rem;
--vibeui-nativeselect-007-arrow:0.375rem;
--vibeui-nativeselect-007-radius:0.5rem;
}
[data-vibeui-block="nativeselect-007"][data-size="lg"]{
--vibeui-nativeselect-007-height:3rem;
--vibeui-nativeselect-007-text:1.0625rem;
--vibeui-nativeselect-007-pad:1rem;
--vibeui-nativeselect-007-arrow:0.5rem;
--vibeui-nativeselect-007-radius:0.75rem;
}
[data-vibeui-block="nativeselect-007"]{
box-sizing:border-box;width:100%;max-width:22rem;
padding:1rem;border-radius:0.875rem;
background:var(--vibeui-nativeselect-007-surface);
border:1px solid var(--vibeui-nativeselect-007-surface-border);
font-family:var(--vibeui-nativeselect-007-font);color:var(--vibeui-nativeselect-007-fg);
display:flex;flex-direction:column;gap:0.375rem;
}
[data-vibeui-block="nativeselect-007"] label{
font-size:0.875rem;font-weight:600;line-height:1.3;cursor:pointer;
}
[data-vibeui-block="nativeselect-007"] [data-part="field"]{position:relative;display:flex}
[data-vibeui-block="nativeselect-007"] select{
appearance:none;-webkit-appearance:none;
box-sizing:border-box;width:100%;
height:var(--vibeui-nativeselect-007-height);
padding:0 calc(var(--vibeui-nativeselect-007-pad) * 2 + var(--vibeui-nativeselect-007-arrow)) 0 var(--vibeui-nativeselect-007-pad);
font:inherit;font-size:var(--vibeui-nativeselect-007-text);line-height:1.2;
color:var(--vibeui-nativeselect-007-fg);
background:var(--vibeui-nativeselect-007-surface);
border:1px solid var(--vibeui-nativeselect-007-field-border);
border-radius:var(--vibeui-nativeselect-007-radius);
cursor:pointer;
transition:border-color .16s ease,box-shadow .16s ease;
}
[data-vibeui-block="nativeselect-007"] select:focus-visible{
outline:none;border-color:var(--vibeui-nativeselect-007-accent);
box-shadow:0 0 0 3px color-mix(in oklab,var(--vibeui-nativeselect-007-accent) 22%,transparent);
}
[data-vibeui-block="nativeselect-007"] option{color:var(--vibeui-nativeselect-007-fg)}
/* Стрелка растёт вместе с полем: её сторона — та же переменная, что
   участвует в правом отступе, поэтому текст никогда не заезжает под неё. */
[data-vibeui-block="nativeselect-007"] [data-part="arrow"]{
position:absolute;right:var(--vibeui-nativeselect-007-pad);top:50%;pointer-events:none;
width:var(--vibeui-nativeselect-007-arrow);height:var(--vibeui-nativeselect-007-arrow);
border-right:1.5px solid var(--vibeui-nativeselect-007-muted);
border-bottom:1.5px solid var(--vibeui-nativeselect-007-muted);
translate:0 calc(var(--vibeui-nativeselect-007-arrow) / -2);rotate:45deg;
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="nativeselect-007"] *{animation:none!important;transition:none!important}}
`

/**
 * Нативный select с размерной шкалой sm / md / lg: три ступени описаны
 * одним набором правил и четырьмя переменными. Один файл, ноль
 * зависимостей.
 */
export function Nativeselect007({
  label = "Размер упаковки",
  size = "md",
  options = ["Конверт", "Коробка S", "Коробка M", "Паллета"],
  accent,
  className,
  style,
  ...props
}: Nativeselect007Props) {
  const id = useId()
  const palette = {
    ...(accent ? { "--vibeui-nativeselect-007-accent": accent } : null),
    ...style,
  } as CSSProperties

  return (
    <>
      <style href="vibeui-nativeselect-007" precedence="medium">
        {STYLES}
      </style>
      <div
        data-vibeui-block="nativeselect-007"
        data-size={size}
        className={className}
        style={palette}
      >
        <label htmlFor={id}>{label}</label>
        <div data-part="field">
          <select {...props} id={id} name="package">
            {options.map((option) => (
              <option key={option} value={option}>
                {option}
              </option>
            ))}
          </select>
          <span data-part="arrow" aria-hidden="true" />
        </div>
      </div>
    </>
  )
}