Inputs

Loading Select

A select in its loading state: the field is disabled, a ring spins beside it, and a skeleton bar with text explains the pause.

  • select
  • loading
  • skeleton
  • state

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-007?lang=en

Loading the list of cities

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-007" (Loading 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-007.json

Registry item: https://vibeui.ru/r/select-007.json
Installs to: components/vibeui/select-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 select in its loading state: the field is disabled, a ring spins beside it, and a skeleton bar with text explains the pause.

A select while its list is loading: a disabled field, a spinner and an explaining line. One file, zero dependencies, a server component.

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

<Select007
  label="Delivery city"
  loading
  loadingText="Loading the list of cities"
/>

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-007-* palette — do not swap it for your theme tokens
- aria-busy together with disabled: a screen reader has to know the field is busy, not broken
- the text beside the spinner: a spinning ring alone never says what is being waited for
- the prefers-reduced-motion rule — two infinite animations must be switchable off
- the conic-gradient spinner with a mask: it is drawn in CSS and pulls in no icon library
- the component's own light surface — without it the dark text disappears on a dark page

## 6. You may change
- the field caption through label
- the waiting state through loading
- the waiting text through loadingText
- the contents of the list through options

## 7. Rules
- The component does not fetch anything: loading is flipped by whoever owns the request.
- Cap a long load with a timeout — an endless spinner is worse than an honest error.
- The field keeps the same height in both states: swapping the list must not shift the form.
- 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-007.json
https://vibeui.ru/r/select-007.json

Серверный компонент с пропом loading. Пока список едет, select выключен и помечен aria-busy, а вместо стрелки стоит спиннер: кольцо из conic-gradient с вырезом через mask — SVG и иконочный пакет не нужны. Строка статуса объявлена role="status". Скелет анимирован смещением background-position. Обе анимации гасятся правилом prefers-reduced-motion. Палитра в --vibeui-select-007-*.

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 Select007Props = Omit<
  ComponentPropsWithoutRef<"select">,
  "size" | "children"
> & {
  label?: string
  options?: string[]
  /** Пока список едет с сервера — поле выключено и объясняет почему. */
  loading?: boolean
  loadingText?: string
  accent?: string
}

// Идея компонента: состояние «список ещё едет». Пустой select с одной
// строкой выглядит как поломка, поэтому поле выключено, подписано и рядом
// крутится маленький индикатор — понятно, что ждать, а не чинить.
// Ширина поля не прыгает при подмене списка: скелет занимает то же место.
const STYLES = `
:where([data-vibeui-block="select-007"]){
--vibeui-select-007-surface:oklch(1 0 0);
--vibeui-select-007-surface-border:oklch(0.91 0.006 265);
--vibeui-select-007-fg:oklch(0.23 0.016 265);
--vibeui-select-007-muted:oklch(0.57 0.014 265);
--vibeui-select-007-field:oklch(0.985 0.002 265);
--vibeui-select-007-border:oklch(0.87 0.008 265);
--vibeui-select-007-accent:oklch(0.55 0.19 245);
--vibeui-select-007-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="select-007"]{
display:flex;flex-direction:column;gap:0.375rem;
width:100%;max-width:20rem;box-sizing:border-box;padding:0.875rem;
background:var(--vibeui-select-007-surface);
border:1px solid var(--vibeui-select-007-surface-border);border-radius:0.875rem;
font-family:var(--vibeui-select-007-font);color:var(--vibeui-select-007-fg);
}
[data-vibeui-block="select-007"] [data-part="label"]{font-size:0.8125rem;font-weight:600}
[data-vibeui-block="select-007"] [data-part="field"]{position:relative;display:block}
[data-vibeui-block="select-007"] select{
appearance:none;-webkit-appearance:none;
width:100%;box-sizing:border-box;margin:0;height:2.75rem;
padding:0 2.75rem 0 0.875rem;
border:1px solid var(--vibeui-select-007-border);border-radius:0.625rem;
background:var(--vibeui-select-007-field);color:inherit;
font:inherit;font-size:0.9375rem;cursor:pointer;
}
[data-vibeui-block="select-007"] select:focus{
outline:none;border-color:var(--vibeui-select-007-accent);
box-shadow:0 0 0 3px color-mix(in oklab,var(--vibeui-select-007-accent) 22%,transparent);
}
[data-vibeui-block="select-007"] select:disabled{
cursor:progress;color:var(--vibeui-select-007-muted);
background:color-mix(in oklab,var(--vibeui-select-007-border) 22%,var(--vibeui-select-007-field));
}
[data-vibeui-block="select-007"] [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-007-muted);
border-bottom:1.5px solid var(--vibeui-select-007-muted);
transform:rotate(45deg);
}
/* Индикатор — кольцо из conic-gradient с вырезом маской: спиннер без SVG
   и без иконочной библиотеки. */
[data-vibeui-block="select-007"] [data-part="spinner"]{
position:absolute;right:0.875rem;top:50%;margin-top:-0.5rem;
width:1rem;height:1rem;border-radius:9999px;pointer-events:none;
background:conic-gradient(from 0deg,transparent 0deg,var(--vibeui-select-007-accent) 300deg);
mask:radial-gradient(farthest-side,transparent calc(100% - 2px),#000 calc(100% - 2px));
-webkit-mask:radial-gradient(farthest-side,transparent calc(100% - 2px),#000 calc(100% - 2px));
animation:vibeui-select-007-spin .8s linear infinite;
}
@keyframes vibeui-select-007-spin{to{transform:rotate(360deg)}}
[data-vibeui-block="select-007"] [data-part="status"]{
display:flex;align-items:center;gap:0.375rem;margin:0;
font-size:0.75rem;line-height:1.4;color:var(--vibeui-select-007-muted);
}
/* Полоска-скелет: намекает, что после загрузки список станет длиннее. */
[data-vibeui-block="select-007"] [data-part="bar"]{
flex:1 1 auto;height:0.375rem;border-radius:9999px;
background:linear-gradient(90deg,color-mix(in oklab,var(--vibeui-select-007-accent) 35%,transparent),color-mix(in oklab,var(--vibeui-select-007-border) 60%,transparent));
background-size:200% 100%;
animation:vibeui-select-007-slide 1.4s ease-in-out infinite;
}
@keyframes vibeui-select-007-slide{0%{background-position:100% 0}100%{background-position:0 0}}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="select-007"] *{animation:none!important;transition:none!important}}
`

const DEFAULT_OPTIONS = [
  "Москва",
  "Санкт-Петербург",
  "Казань",
  "Новосибирск",
  "Екатеринбург",
]

/**
 * Select во время загрузки списка: поле выключено, индикатор объясняет паузу.
 * Один файл, ноль зависимостей, собственная палитра.
 */
export function Select007({
  label = "Город доставки",
  options = DEFAULT_OPTIONS,
  loading = true,
  loadingText = "Загружаем список городов",
  accent,
  id,
  className,
  style,
  ...props
}: Select007Props) {
  const palette = {
    ...(accent ? { "--vibeui-select-007-accent": accent } : null),
    ...style,
  } as CSSProperties

  return (
    <>
      <style href="vibeui-select-007" precedence="medium">
        {STYLES}
      </style>
      <div
        data-vibeui-block="select-007"
        data-loading={loading}
        className={className}
        style={palette}
      >
        <label data-part="label" htmlFor={id}>
          {label}
        </label>
        <span data-part="field">
          <select
            {...props}
            id={id}
            disabled={loading}
            aria-busy={loading}
            defaultValue=""
          >
            <option value="" disabled>
              {loading ? loadingText + "…" : "Выберите город"}
            </option>
            {loading
              ? null
              : options.map((option) => (
                  <option key={option} value={option}>
                    {option}
                  </option>
                ))}
          </select>
          {loading ? (
            <span data-part="spinner" aria-hidden="true" />
          ) : (
            <span data-part="arrow" aria-hidden="true" />
          )}
        </span>
        {loading ? (
          <p data-part="status" role="status">
            <span data-part="bar" aria-hidden="true" />
            <span>{loadingText}</span>
          </p>
        ) : null}
      </div>
    </>
  )
}