Inputs

Multiple List Select

Multiple choice on a native select[multiple]: the whole list stays open, chosen rows are highlighted, and no dropdown is needed.

  • select
  • multiple
  • form
  • native

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/select-004?lang=en

Several — hold the key Ctrl /

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-004" (Multiple List 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-004.json

Registry item: https://vibeui.ru/r/select-004.json
Installs to: components/vibeui/select-004.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
Multiple choice on a native select[multiple]: the whole list stays open, chosen rows are highlighted, and no dropdown is needed.

An always-open multiple-choice list built on a native select[multiple]. One file, zero dependencies, a server component.

## 3. How to use it
import { Select004 } from "@/components/vibeui/select-004"

<Select004
  label="Areas of work"
  rows={5}
  defaultValue={["frontend", "analytics"]}
/>

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-004-* palette — do not swap it for your theme tokens
- the native multiple instead of a checkbox list: only it gives Shift range selection and submits an array of values
- the option:checked rule: without it the chosen rows show only in the system highlight, which differs per OS
- the visible Ctrl and ⌘ hint — multiple selection with a mouse is not obvious and gets lost without it
- the component's own light surface — without it the dark text disappears on a dark page
- the visible focus ring on the list: it outlines the whole field, not a single row

## 6. You may change
- the field caption through label
- the helper line under the list through hint
- the visible height in rows through rows
- the set of options through options

## 7. Rules
- Styling of option is limited: colour and weight work, but padding and radius are not applied in every browser.
- On phones the list looks like an ordinary multi-line select — check that rows does not eat the screen.
- Clearing the selection is a click without Ctrl: that is system behaviour and cannot be overridden without JS.
- 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-004.json
https://vibeui.ru/r/select-004.json

Серверный компонент. Основа — <select multiple size={rows}>: список раскрыт постоянно, поэтому после каждого клика не приходится открывать меню заново. Выбранные строки красит правило option:checked — у списочного select оно работает и без своей отрисовки. defaultValue принимает массив значений. Подсказка про Ctrl/⌘ вынесена под поле и оформлена <kbd>. Палитра в --vibeui-select-004-*, зависимостей нет.

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 Select004Option = {
  value: string
  label: string
}

export type Select004Props = Omit<
  ComponentPropsWithoutRef<"select">,
  "size" | "children" | "multiple"
> & {
  label?: string
  hint?: string
  options?: Select004Option[]
  /** Сколько строк списка видно без прокрутки. */
  rows?: number
  accent?: string
}

// Идея компонента: множественный выбор без выпадающего меню. Нативный
// select[multiple] показывает весь список сразу, поэтому не приходится
// открывать его заново после каждого клика, а состояние выбранных строк
// рисует :checked — самодельный список чекбоксов здесь только мешал бы форме.
const STYLES = `
:where([data-vibeui-block="select-004"]){
--vibeui-select-004-surface:oklch(1 0 0);
--vibeui-select-004-surface-border:oklch(0.91 0.006 265);
--vibeui-select-004-fg:oklch(0.23 0.016 265);
--vibeui-select-004-muted:oklch(0.55 0.014 265);
--vibeui-select-004-field:oklch(0.985 0.002 265);
--vibeui-select-004-border:oklch(0.87 0.008 265);
--vibeui-select-004-accent:oklch(0.55 0.19 285);
--vibeui-select-004-tint:oklch(0.55 0.19 285 / 14%);
--vibeui-select-004-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="select-004"]{
display:flex;flex-direction:column;gap:0.375rem;
width:100%;max-width:20rem;box-sizing:border-box;padding:0.875rem;
background:var(--vibeui-select-004-surface);
border:1px solid var(--vibeui-select-004-surface-border);border-radius:0.875rem;
font-family:var(--vibeui-select-004-font);color:var(--vibeui-select-004-fg);
}
[data-vibeui-block="select-004"] [data-part="label"]{font-size:0.8125rem;font-weight:600}
[data-vibeui-block="select-004"] select{
box-sizing:border-box;width:100%;margin:0;padding:0.25rem;
border:1px solid var(--vibeui-select-004-border);border-radius:0.625rem;
background:var(--vibeui-select-004-field);color:inherit;
font:inherit;font-size:0.875rem;
}
[data-vibeui-block="select-004"] select:focus-visible{
outline:2px solid var(--vibeui-select-004-accent);outline-offset:1px;border-color:transparent;
}
/* Выбранная строка красится сама: у select[multiple] :checked работает
   на option, а не только на подсветке системным цветом. */
[data-vibeui-block="select-004"] option{
padding:0.375rem 0.5rem;border-radius:0.375rem;color:inherit;
}
[data-vibeui-block="select-004"] option:checked{
background:var(--vibeui-select-004-tint);
color:var(--vibeui-select-004-accent);font-weight:600;
}
[data-vibeui-block="select-004"] [data-part="hint"]{
margin:0;font-size:0.75rem;line-height:1.4;color:var(--vibeui-select-004-muted);
}
[data-vibeui-block="select-004"] kbd{
font:inherit;font-size:0.6875rem;padding:0.0625rem 0.3125rem;
border:1px solid var(--vibeui-select-004-border);border-radius:0.25rem;
background:var(--vibeui-select-004-field);
}
`

const DEFAULT_OPTIONS: Select004Option[] = [
  { value: "design", label: "Дизайн" },
  { value: "frontend", label: "Фронтенд" },
  { value: "backend", label: "Бэкенд" },
  { value: "analytics", label: "Аналитика" },
  { value: "content", label: "Контент" },
  { value: "qa", label: "Тестирование" },
]

/**
 * Множественный выбор на нативном select[multiple]: весь список виден сразу.
 * Один файл, ноль зависимостей, собственная палитра.
 */
export function Select004({
  label = "Направления работы",
  hint = "Несколько — с зажатой клавишей",
  options = DEFAULT_OPTIONS,
  rows = 5,
  accent,
  id,
  className,
  style,
  defaultValue = ["frontend", "analytics"],
  ...props
}: Select004Props) {
  const palette = {
    ...(accent ? { "--vibeui-select-004-accent": accent } : null),
    ...style,
  } as CSSProperties

  return (
    <>
      <style href="vibeui-select-004" precedence="medium">
        {STYLES}
      </style>
      <div data-vibeui-block="select-004" className={className} style={palette}>
        <label data-part="label" htmlFor={id}>
          {label}
        </label>
        <select
          {...props}
          id={id}
          multiple
          size={rows}
          defaultValue={defaultValue}
        >
          {options.map((option) => (
            <option key={option.value} value={option.value}>
              {option.label}
            </option>
          ))}
        </select>
        {hint ? (
          <p data-part="hint">
            {hint} <kbd>Ctrl</kbd> / <kbd>⌘</kbd>
          </p>
        ) : null}
      </div>
    </>
  )
}