Display
Pressed Tile Button
A tile button with an honest pressed state: the toggle is declared through aria-pressed and shown by a sunken shadow, not by colour alone.
- icontile
- toggle
- button
- pressed
Preview
Use it with AI
- 1. Copy the link.
- 2. Write to your agent in your own words and drop the link into the sentence.
- 3. The agent opens the link and installs the component from the registry.
put this in the header: https://vibeui.ru/c/icontile-006?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 "icontile-006" (Pressed Tile Button) 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/icontile-006.json
Registry item: https://vibeui.ru/r/icontile-006.json
Installs to: components/vibeui/icontile-006.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 tile button with an honest pressed state: the toggle is declared through aria-pressed and shown by a sunken shadow, not by colour alone.
A toggle tile: aria-pressed for the state and a sunken shadow so the press is visible. Zero dependencies, one file, state in useState.
## 3. How to use it
import { Icontile006 } from "@/components/vibeui/icontile-006"
<Icontile006 glyph="★" label="Add to favourites" defaultPressed />
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-icontile-006-* palette — do not swap it for your theme tokens
- aria-pressed instead of a class: without it a screen reader cannot say whether the state is on
- both press cues at once — colour and the sunken shadow: colour alone fails in monochrome
- the aria-label on the button: a glyph tile without a name is useless to a screen reader
- the visible focus ring — these tiles usually sit in a row and get toggled from the keyboard
- the light idle fill: a dark button disappears on a dark catalog background
## 6. You may change
- the button glyph through glyph and its name through label
- the initial state through defaultPressed
- the pressed hue through the --vibeui-icontile-006-hue variable
- the size through the --vibeui-icontile-006-size variable
## 7. Rules
- The state is internal: lift it into the parent and drop useState for a controlled variant.
- A toggle button does not replace a form checkbox — it submits nothing.
- The one-pixel press shift is disabled together with the transition under prefers-reduced-motion.
- 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/icontile-006.jsonhttps://vibeui.ru/r/icontile-006.jsonКлиентский компонент: держит состояние в useState, поэтому в файле есть «use client». Состояние объявлено атрибутом aria-pressed, а не классом — без него скринридер сообщит просто «кнопка» и не скажет, включено ли. Визуально нажатие показано двумя признаками сразу: заливка меняется и плитка утоплена inset-тенью со сдвигом на пиксель, поэтому включённость видна и в чёрно-белом режиме. Доступное имя берётся из label, знак помечен aria-hidden. Заливка в покое светлая, так что кнопка читается на тёмной подложке каталога.
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 Icontile006Props = Omit<
ComponentPropsWithoutRef<"button">,
"children"
> & {
glyph?: string
label?: string
defaultPressed?: boolean
}
// Идея компонента: плитка-переключатель с честным нажатым состоянием.
// Состояние объявлено через aria-pressed, а не подкрашено классом: без него
// скринридер сообщит просто «кнопка» и не скажет, включено ли. Нажатие видно
// не одним цветом — плитка утоплена внутренней тенью и сдвинута на пиксель,
// поэтому включённость читается и в чёрно-белом режиме.
const STYLES = `
:where([data-vibeui-block="icontile-006"]){
--vibeui-icontile-006-size:2.75rem;
--vibeui-icontile-006-hue:262;
--vibeui-icontile-006-idle:oklch(0.96 0.004 265);
--vibeui-icontile-006-fg:oklch(0.36 0.014 265);
--vibeui-icontile-006-border:oklch(0.89 0.006 265);
--vibeui-icontile-006-ring:oklch(0.55 0.17 262 / 60%);
--vibeui-icontile-006-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="icontile-006"]{
appearance:none;cursor:pointer;
display:inline-grid;place-items:center;flex:none;box-sizing:border-box;
width:var(--vibeui-icontile-006-size);height:var(--vibeui-icontile-006-size);
padding:0;border-radius:0.875rem;
background:var(--vibeui-icontile-006-idle);
border:1px solid var(--vibeui-icontile-006-border);
color:var(--vibeui-icontile-006-fg);
font-family:var(--vibeui-icontile-006-font);
font-size:calc(var(--vibeui-icontile-006-size) * 0.44);line-height:1;
transition:background-color .16s ease,color .16s ease,transform .1s ease,box-shadow .16s ease;
}
[data-vibeui-block="icontile-006"]:hover{background:oklch(0.93 0.01 var(--vibeui-icontile-006-hue))}
[data-vibeui-block="icontile-006"]:focus-visible{outline:2px solid var(--vibeui-icontile-006-ring);outline-offset:2px}
/* Нажатое состояние — не только цвет: утопленная тень видна и без цвета. */
[data-vibeui-block="icontile-006"][aria-pressed="true"]{
background:oklch(0.55 0.17 var(--vibeui-icontile-006-hue));
border-color:oklch(0.47 0.17 var(--vibeui-icontile-006-hue));
color:oklch(0.99 0 0);
box-shadow:inset 0 2px 4px oklch(0.25 0.1 var(--vibeui-icontile-006-hue) / 45%);
transform:translateY(1px);
}
[data-vibeui-block="icontile-006"]:active{transform:translateY(1px)}
[data-vibeui-block="icontile-006"]:disabled{cursor:not-allowed;opacity:.5}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="icontile-006"]{animation:none!important;transition:none!important}}
`
/**
* Плитка-кнопка с нажатым состоянием на aria-pressed.
* Один файл, ноль зависимостей, собственная палитра.
*/
export function Icontile006({
glyph = "★",
label = "В избранное",
defaultPressed = false,
type = "button",
onClick,
className,
style,
...props
}: Icontile006Props) {
const [pressed, setPressed] = useState(defaultPressed)
return (
<>
<style href="vibeui-icontile-006" precedence="medium">
{STYLES}
</style>
<button
{...props}
type={type}
data-vibeui-block="icontile-006"
aria-pressed={pressed}
aria-label={label}
onClick={(event) => {
setPressed((value) => !value)
onClick?.(event)
}}
className={className}
style={style as CSSProperties}
>
<span aria-hidden="true">{glyph}</span>
</button>
</>
)
}