Native Select

Filter Inline

Compact native selects in a filter row: no resting border, width driven by the chosen text, labels sitting to the left on the same line.

  • select
  • filter
  • compact
  • toolbar

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-005?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-005" (Filter Inline) 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-005.json

Registry item: https://vibeui.ru/r/nativeselect-005.json
Installs to: components/vibeui/nativeselect-005.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
Compact native selects in a filter row: no resting border, width driven by the chosen text, labels sitting to the left on the same line.

A filter row of two native selects: quiet border, width by content, labels on the left. Zero dependencies, one file, no client JS.

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

<Nativeselect005
  label="Sort"
  options={["by date", "by name"]}
  secondLabel="Show"
  secondOptions={["all", "mine only"]}
/>

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-005-* palette — do not swap it for your theme tokens
- real <label> elements with htmlFor: a caption beside the field is not decoration, it enlarges the target and is read aloud
- width:auto on the selects — a fixed width in a filter row either clips text or leaves a hole
- the visible focus ring: on a borderless field focus is otherwise indistinguishable
- flex-wrap on the row: on a narrow screen the pairs must wrap instead of squeezing into mush
- the row's own light surface: without it the dark text disappears on a dark background

## 6. You may change
- the captions through label and secondLabel, the value sets through options and secondOptions
- the focus color through accent
- the row density through its padding and gap
- the number of pairs: the flex layout takes a third one

## 7. Rules
- A height of 1.75rem is small for a finger: raise it to 2.75rem if the filter row lives on phones too.
- A quiet border demands a loud focus — do not drop the outline for looks, or the filter is unreachable by keyboard.
- Filters usually apply on change: say so, or add an explicit apply button.
- 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-005.json
https://vibeui.ru/r/nativeselect-005.json

Компонент самодостаточен: один файл, без зависимостей, палитра в локальных переменных --vibeui-nativeselect-005-*. Серверный: из хуков только useId, идентификаторы двух полей выводятся из одного корня. В строке фильтров поле не должно выглядеть полем формы: рамка прозрачная и проявляется на наведении и фокусе, ширина select оставлена auto — браузер берёт её по самому длинному пункту, поэтому строка не растягивается. Подпись стоит слева от поля и остаётся настоящим <label> с htmlFor: связь с полем важнее компактности. Строка переносится (flex-wrap), поэтому на узком экране пары «подпись — поле» встают друг под друга.

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 Nativeselect005Props = Omit<
  ComponentPropsWithoutRef<"div">,
  "children"
> & {
  label?: string
  options?: string[]
  secondLabel?: string
  secondOptions?: string[]
  accent?: string
}

// Идея компонента: в строке фильтров select не должен выглядеть полем
// формы. Рамка снята и появляется только на наведении и фокусе, ширина
// поля равна тексту выбранного пункта, подпись стоит слева в той же
// строке. Список при этом остаётся системным: на телефоне открывается
// привычное колесо, а не самодельное меню, которое едет при масштабе.
const STYLES = `
:where([data-vibeui-block="nativeselect-005"]){
--vibeui-nativeselect-005-surface:oklch(0.98 0.002 265);
--vibeui-nativeselect-005-surface-border:oklch(0.91 0.006 265);
--vibeui-nativeselect-005-fg:oklch(0.24 0.016 265);
--vibeui-nativeselect-005-muted:oklch(0.54 0.014 265);
--vibeui-nativeselect-005-hover:oklch(1 0 0);
--vibeui-nativeselect-005-accent:oklch(0.55 0.2 262);
--vibeui-nativeselect-005-radius:0.5rem;
--vibeui-nativeselect-005-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="nativeselect-005"]{
box-sizing:border-box;width:100%;max-width:32rem;
display:flex;flex-wrap:wrap;align-items:center;gap:0.25rem 1rem;
padding:0.5rem 0.75rem;border-radius:0.75rem;
background:var(--vibeui-nativeselect-005-surface);
border:1px solid var(--vibeui-nativeselect-005-surface-border);
font-family:var(--vibeui-nativeselect-005-font);color:var(--vibeui-nativeselect-005-fg);
}
[data-vibeui-block="nativeselect-005"] [data-part="pair"]{
display:inline-flex;align-items:center;gap:0.25rem;min-width:0;
}
[data-vibeui-block="nativeselect-005"] label{
font-size:0.8125rem;line-height:1.3;color:var(--vibeui-nativeselect-005-muted);
cursor:pointer;white-space:nowrap;
}
[data-vibeui-block="nativeselect-005"] [data-part="field"]{
position:relative;display:inline-flex;min-width:0;
}
/* Ширина поля равна тексту: width:auto у select берётся по самому
   длинному пункту, поэтому «тихий» фильтр не растягивает строку. */
[data-vibeui-block="nativeselect-005"] select{
appearance:none;-webkit-appearance:none;
box-sizing:border-box;width:auto;max-width:100%;height:1.75rem;
padding:0 1.375rem 0 0.375rem;
font:inherit;font-size:0.8125rem;font-weight:500;line-height:1.2;
color:var(--vibeui-nativeselect-005-fg);
background:transparent;border:1px solid transparent;
border-radius:var(--vibeui-nativeselect-005-radius);
cursor:pointer;
transition:background-color .16s ease,border-color .16s ease;
}
[data-vibeui-block="nativeselect-005"] select:hover{
background:var(--vibeui-nativeselect-005-hover);
border-color:var(--vibeui-nativeselect-005-surface-border);
}
[data-vibeui-block="nativeselect-005"] select:focus-visible{
outline:2px solid var(--vibeui-nativeselect-005-accent);outline-offset:1px;
background:var(--vibeui-nativeselect-005-hover);
}
[data-vibeui-block="nativeselect-005"] option{color:var(--vibeui-nativeselect-005-fg)}
[data-vibeui-block="nativeselect-005"] [data-part="arrow"]{
position:absolute;right:0.5rem;top:50%;pointer-events:none;
width:0.3125rem;height:0.3125rem;
border-right:1.5px solid var(--vibeui-nativeselect-005-muted);
border-bottom:1.5px solid var(--vibeui-nativeselect-005-muted);
translate:0 -0.1875rem;rotate:45deg;
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="nativeselect-005"] *{animation:none!important;transition:none!important}}
`

/**
 * Компактные нативные select'ы в строке фильтров: без рамки, шириной по
 * тексту, с подписями слева. Один файл, ноль зависимостей.
 */
export function Nativeselect005({
  label = "Сортировка",
  options = ["по дате", "по имени", "по размеру"],
  secondLabel = "Показывать",
  secondOptions = ["все", "только мои", "в архиве"],
  accent,
  className,
  style,
  ...props
}: Nativeselect005Props) {
  const id = useId()
  const palette = {
    ...(accent ? { "--vibeui-nativeselect-005-accent": accent } : null),
    ...style,
  } as CSSProperties

  return (
    <>
      <style href="vibeui-nativeselect-005" precedence="medium">
        {STYLES}
      </style>
      <div
        {...props}
        data-vibeui-block="nativeselect-005"
        className={className}
        style={palette}
      >
        <span data-part="pair">
          <label htmlFor={`${id}-sort`}>{label}</label>
          <span data-part="field">
            <select id={`${id}-sort`} name="sort">
              {options.map((option) => (
                <option key={option} value={option}>
                  {option}
                </option>
              ))}
            </select>
            <span data-part="arrow" aria-hidden="true" />
          </span>
        </span>
        <span data-part="pair">
          <label htmlFor={`${id}-scope`}>{secondLabel}</label>
          <span data-part="field">
            <select id={`${id}-scope`} name="scope">
              {secondOptions.map((option) => (
                <option key={option} value={option}>
                  {option}
                </option>
              ))}
            </select>
            <span data-part="arrow" aria-hidden="true" />
          </span>
        </span>
      </div>
    </>
  )
}