Buttons

Expanding FAB

A round primary-action button whose label unrolls on hover and focus instead of floating over its neighbours.

  • button
  • fab
  • hover
  • action

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/button-014?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 "button-014" (Expanding FAB) 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/button-014.json

Registry item: https://vibeui.ru/r/button-014.json
Installs to: components/vibeui/button-014.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 round primary-action button whose label unrolls on hover and focus instead of floating over its neighbours.

A round primary action button that expands into a labelled pill on hover and focus. Zero dependencies, one file, no client JS.

## 3. How to use it
import { Button014 } from "@/components/vibeui/button-014"

<Button014 label="New task" accent="oklch(0.55 0.17 265)" />

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-button-014-* palette — do not swap it for your theme tokens
- expanding on focus as well as hover — keyboard users need the label too
- the aria-label: collapsed, the button is just a plus
- growing in width instead of a tooltip covering neighbours
- the shadow tied to the accent through color-mix
- the prefers-reduced-motion rule that drops the width animation

## 6. You may change
- label — the screen's primary action
- hint — the browser tooltip text
- the accent through the accent prop
- the size through the variable

## 7. Rules
- Positioning is not part of the component: fixed placement belongs to the caller.
- A screen has one primary action: two of these side by side defeat the idea.
- Phones have no hover — the label shows only on focus there, so the action name must read well without it.
- 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/button-014.json
https://vibeui.ru/r/button-014.json

Компонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-button-014-*. Серверный: хуков нет. Подпись всегда в разметке, но её max-width равен нулю и растёт до 12rem на hover и focus-visible — так кнопка расширяется в потоке, а не накрывает соседей. Имя действия продублировано в aria-label. Плюс нарисован двумя полосками.

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 Button014Props = Omit<
  ComponentPropsWithoutRef<"button">,
  "children"
> & {
  label?: string
  hint?: string
  accent?: string
}

// Идея компонента: круглая кнопка главного действия, у которой подпись
// выезжает при наведении и при фокусе. Круг с одним плюсом ничего не
// сообщает, а постоянная подпись занимает место в углу экрана — компромисс
// в том, чтобы имя было всегда доступно скринридеру и появлялось глазу.
const STYLES = `
:where([data-vibeui-block="button-014"]){
--vibeui-button-014-size:3.25rem;
--vibeui-button-014-accent:oklch(0.55 0.17 265);
--vibeui-button-014-fg:oklch(0.99 0.01 265);
--vibeui-button-014-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="button-014"]{
appearance:none;border:0;cursor:pointer;
display:inline-flex;align-items:center;gap:0.5rem;
height:var(--vibeui-button-014-size);
/* Ширина едет от круга к пилюле: подпись раскрывается, а не появляется
   поверх соседей. */
padding:0 calc((var(--vibeui-button-014-size) - 1rem) / 2);
border-radius:9999px;
background:var(--vibeui-button-014-accent);color:var(--vibeui-button-014-fg);
font-family:var(--vibeui-button-014-font);font-size:0.875rem;font-weight:650;line-height:1;
box-shadow:0 12px 24px -12px color-mix(in oklab,var(--vibeui-button-014-accent) 70%,transparent);
transition:padding .18s ease,filter .16s ease;
}
[data-vibeui-block="button-014"]:hover{filter:brightness(0.96)}
[data-vibeui-block="button-014"]:focus-visible{outline:2px solid var(--vibeui-button-014-accent);outline-offset:3px}
[data-vibeui-block="button-014"] [data-part="plus"]{position:relative;flex:none;width:1rem;height:1rem}
[data-vibeui-block="button-014"] [data-part="plus"]::before,
[data-vibeui-block="button-014"] [data-part="plus"]::after{
content:"";position:absolute;left:50%;top:50%;background:currentColor;border-radius:9999px;
}
[data-vibeui-block="button-014"] [data-part="plus"]::before{width:0.875rem;height:1.75px;margin:-0.875px 0 0 -0.4375rem}
[data-vibeui-block="button-014"] [data-part="plus"]::after{width:1.75px;height:0.875rem;margin:-0.4375rem 0 0 -0.875px}
/* Подпись раскрывается по ширине: у скрытой ширины 0, но она в разметке. */
[data-vibeui-block="button-014"] [data-part="label"]{
display:inline-block;max-width:0;overflow:hidden;white-space:nowrap;
opacity:0;transition:max-width .18s ease,opacity .14s ease;
}
[data-vibeui-block="button-014"]:hover [data-part="label"],
[data-vibeui-block="button-014"]:focus-visible [data-part="label"]{max-width:12rem;opacity:1}
[data-vibeui-block="button-014"]:hover,
[data-vibeui-block="button-014"]:focus-visible{padding:0 1.125rem}
@media (prefers-reduced-motion:reduce){
[data-vibeui-block="button-014"] *{animation:none!important;transition:none!important}
[data-vibeui-block="button-014"]{transition:none!important}
}
`

/**
 * Круглая кнопка главного действия: подпись раскрывается при наведении.
 * Один файл, ноль зависимостей, собственная палитра.
 */
export function Button014({
  label = "Новая задача",
  hint,
  accent,
  type = "button",
  className,
  style,
  ...props
}: Button014Props) {
  const palette = {
    ...(accent ? { "--vibeui-button-014-accent": accent } : null),
    ...style,
  } as CSSProperties

  return (
    <>
      <style href="vibeui-button-014" precedence="medium">
        {STYLES}
      </style>
      <button
        {...props}
        type={type}
        data-vibeui-block="button-014"
        className={className}
        style={palette}
        aria-label={label}
        title={hint ?? label}
      >
        <span data-part="plus" aria-hidden="true" />
        <span data-part="label" aria-hidden="true">
          {label}
        </span>
      </button>
    </>
  )
}