Inputs

Saved Views

Saved filter sets: every view shows not just a name but the conditions behind it, and shared views are marked — editing one changes the whole team's screen.

  • filters
  • presets
  • views
  • saved

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

Saved views

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 "filters-007" (Saved Views) 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/filters-007.json

Registry item: https://vibeui.ru/r/filters-007.json
Installs to: components/vibeui/filters-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
Saved filter sets: every view shows not just a name but the conditions behind it, and shared views are marked — editing one changes the whole team's screen.

A list of saved filter sets: name, a spelled-out set of conditions, a shared marker and a button to save the current selection. The active view is announced through aria-pressed. Zero dependencies, one file, its own palette.

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

<Filters007
  views={[{ id: "week", name: "Mine this week", summary: "Author: me · last 7 days" }]}
  onChange={(id) => applyView(id)}
/>

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-filters-007-* palette — do not swap it for your theme tokens (bg-accent, border-input and the like)
- the conditions spelled out under the name: a week later the name alone will not recall what is inside
- aria-pressed on the view button — the active set has to be announced, not only highlighted
- the full-width button: a one-word target is awkward with a mouse and worse with a finger
- the shared marker: editing such a view changes the whole team's screen, and that must be said before the click
- the indicator dot beside the name as a second, non-colour cue for the chosen view
- the <style> block inside the component — it holds the palette, the view rows and the save button

## 6. You may change
- the title above the list
- the views array: names, condition summaries and shared markers
- the saveLabel button caption
- the onChange handler: it receives the id of the chosen view
- the accent through the accent prop — it colours the active view

## 7. Rules
- Saving here only appends a row: the real save on the server belongs to the caller.
- Renaming and deleting views are out of scope — they need a per-row menu.
- A shared view deserves a confirmation on edit: people rarely realise they are changing someone else's screen.
- 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/filters-007.json
https://vibeui.ru/r/filters-007.json

Компонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-filters-007-*. Клиентский: "use client" ради выбора и сохранения. Вид — кнопка во всю строку с aria-pressed: мишень крупная, а состояние объявлено ролью, а не только цветом. Под именем стоит расшифровка условий, потому что по одному имени через неделю не вспомнить содержимое. Общие виды помечены отдельной меткой.

Component source

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

"use client"

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

export type Filters007View = {
  id: string
  name: string
  summary: string
  shared?: boolean
}

export type Filters007Props = Omit<
  ComponentPropsWithoutRef<"div">,
  "children" | "onChange"
> & {
  title?: string
  views?: Filters007View[]
  saveLabel?: string
  onChange?: (id: string) => void
  accent?: string
}

// Идея компонента: набор фильтров как именованный вид. Один и тот же отбор
// собирают заново каждое утро, и это самая частая ручная работа в любой
// таблице. Здесь каждый вид показывает не только имя, но и расшифровку
// условий — по одному имени через неделю не вспомнить, что внутри. Общие
// виды помечены отдельно: их правка меняет экран всей команде.
const STYLES = `
:where([data-vibeui-block="filters-007"]){
--vibeui-filters-007-surface:oklch(1 0 0);
--vibeui-filters-007-fill:oklch(0.975 0.004 265);
--vibeui-filters-007-fg:oklch(0.23 0.014 265);
--vibeui-filters-007-muted:oklch(0.55 0.014 265);
--vibeui-filters-007-border:oklch(0.89 0.008 265);
--vibeui-filters-007-shell:oklch(0.91 0.006 265);
--vibeui-filters-007-accent:oklch(0.5 0.16 210);
--vibeui-filters-007-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
/* Своя светлая подложка: список показывают поверх любого фона. */
[data-vibeui-block="filters-007"]{
display:flex;flex-direction:column;gap:0.5rem;
width:100%;max-width:20rem;box-sizing:border-box;padding:0.875rem;
background:var(--vibeui-filters-007-surface);
border:1px solid var(--vibeui-filters-007-shell);border-radius:0.875rem;
font-family:var(--vibeui-filters-007-font);color:var(--vibeui-filters-007-fg);
}
[data-vibeui-block="filters-007"] *{box-sizing:border-box}
[data-vibeui-block="filters-007"] h3{margin:0;font-size:0.8125rem;font-weight:650}
[data-vibeui-block="filters-007"] ul{
display:flex;flex-direction:column;gap:0.25rem;margin:0;padding:0;list-style:none;
}
/* Вид — одна кнопка целиком: мишень в строку, а не крошечное имя. */
[data-vibeui-block="filters-007"] [data-part="view"]{
appearance:none;cursor:pointer;width:100%;text-align:start;
display:flex;flex-direction:column;gap:0.125rem;
padding:0.5rem 0.625rem;border-radius:0.625rem;
border:1px solid var(--vibeui-filters-007-border);
background:var(--vibeui-filters-007-surface);color:inherit;font:inherit;
transition:border-color .16s ease,background-color .16s ease;
}
[data-vibeui-block="filters-007"] [data-part="view"]:hover{background:var(--vibeui-filters-007-fill)}
[data-vibeui-block="filters-007"] [data-part="view"]:focus-visible{outline:2px solid var(--vibeui-filters-007-accent);outline-offset:2px}
[data-vibeui-block="filters-007"] [data-part="view"][aria-pressed="true"]{
border-color:var(--vibeui-filters-007-accent);
background:color-mix(in oklab,var(--vibeui-filters-007-accent) 8%,oklch(1 0 0));
}
[data-vibeui-block="filters-007"] [data-part="line"]{
display:flex;align-items:center;gap:0.375rem;
font-size:0.8125rem;font-weight:650;
}
[data-vibeui-block="filters-007"] [data-part="dot"]{
flex:none;width:0.4375rem;height:0.4375rem;border-radius:9999px;
background:var(--vibeui-filters-007-border);
}
[data-vibeui-block="filters-007"] [data-part="view"][aria-pressed="true"] [data-part="dot"]{background:var(--vibeui-filters-007-accent)}
/* Расшифровка условий: по одному имени через неделю не вспомнить, что внутри. */
[data-vibeui-block="filters-007"] [data-part="summary"]{
font-size:0.6875rem;line-height:1.4;color:var(--vibeui-filters-007-muted);
}
[data-vibeui-block="filters-007"] [data-part="shared"]{
margin-inline-start:auto;flex:none;
padding:0.0625rem 0.375rem;border-radius:9999px;
background:var(--vibeui-filters-007-fill);
font-size:0.5625rem;font-weight:700;text-transform:uppercase;letter-spacing:0.04em;
color:var(--vibeui-filters-007-muted);
}
[data-vibeui-block="filters-007"] [data-part="save"]{
appearance:none;cursor:pointer;align-self:flex-start;
padding:0.375rem 0.75rem;border-radius:0.5rem;
border:1px dashed var(--vibeui-filters-007-border);
background:none;color:var(--vibeui-filters-007-accent);
font:inherit;font-size:0.75rem;font-weight:650;
}
[data-vibeui-block="filters-007"] [data-part="save"]:hover{border-style:solid;border-color:var(--vibeui-filters-007-accent)}
[data-vibeui-block="filters-007"] [data-part="save"]:focus-visible{outline:2px solid var(--vibeui-filters-007-accent);outline-offset:2px}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="filters-007"] *{animation:none!important;transition:none!important}}
`

const DEFAULT_VIEWS: Filters007View[] = [
  {
    id: "week",
    name: "Мои за неделю",
    summary: "Автор: я · Обновлён: за 7 дней",
  },
  {
    id: "review",
    name: "Ждут проверки",
    summary: "Статус: на ревью · Приоритет: высокий",
    shared: true,
  },
  {
    id: "free",
    name: "Бесплатные шаблоны",
    summary: "Цена: 0 ₽ · Лицензия: MIT",
    shared: true,
  },
]

/**
 * Сохранённые наборы фильтров: имя, расшифровка условий и метка общего вида.
 * Один файл, ноль зависимостей, собственная палитра.
 */
export function Filters007({
  title = "Сохранённые виды",
  views = DEFAULT_VIEWS,
  saveLabel = "Сохранить текущий отбор",
  onChange,
  accent,
  className,
  style,
  ...props
}: Filters007Props) {
  const [list, setList] = useState(views)
  const [active, setActive] = useState(views[0]?.id ?? "")

  const palette = {
    ...(accent ? { "--vibeui-filters-007-accent": accent } : null),
    ...style,
  } as CSSProperties

  const pick = (id: string) => {
    setActive(id)
    onChange?.(id)
  }

  const save = () => {
    const id = `view-${list.length + 1}`

    setList([
      ...list,
      {
        id,
        name: `Новый вид ${list.length + 1}`,
        summary: "Текущие условия отбора",
      },
    ])
    pick(id)
  }

  return (
    <>
      <style href="vibeui-filters-007" precedence="medium">
        {STYLES}
      </style>
      <div
        {...props}
        data-vibeui-block="filters-007"
        className={className}
        style={palette}
      >
        <h3>{title}</h3>
        <ul>
          {list.map((view) => (
            <li key={view.id}>
              <button
                type="button"
                data-part="view"
                aria-pressed={active === view.id}
                onClick={() => pick(view.id)}
              >
                <span data-part="line">
                  <span data-part="dot" aria-hidden="true" />
                  {view.name}
                  {view.shared ? <span data-part="shared">общий</span> : null}
                </span>
                <span data-part="summary">{view.summary}</span>
              </button>
            </li>
          ))}
        </ul>
        <button type="button" data-part="save" onClick={save}>
          {saveLabel}
        </button>
      </div>
    </>
  )
}