Skip to content
HomeCobalt

Grow

A button that grows into the one small form it opens, such as a link to add or a name to save, and shrinks back when you are done.

Examples

Add a source grows into the form it opens, and the sources below it make room.
  • Scaling laws for retrieval
    arxiv.org
  • Open web crawl, March sample
    commoncrawl.org
  • Benchmark leaderboard
    paperswithcode.com
FloatingSave view floats over the table, so the rows stay where they are.
Status is Failed
JobReason
orders_dailyTimeout
invoices_weeklySchema changed
sessions_hourlyTimeout
refunds_dailyQuota reached
accounts_syncCredentials expired

Usage

Use it when

  • A control asks for one small answer, a line of text or a name, and you should keep your eyes on the control you pressed while you type: the panel grows out of it.
  • A toolbar control sits over dense content that must not move, such as a table: floating.

Use something else when

  • The content is a list of commands. Use DropdownMenu instead, which has menu roles and keyboard selection.
  • The panel would hold more than 1 field. Use Sheet instead.
  • The answer needs a decision with a title, a body and two actions. Use Dialog or AlertDialog instead.
  • The panel is informational and anchored to a control without becoming it. Use Popover instead.
  • A row of a list, a line of a card or a question opens to its details or its answer. Use Collapsible instead, which owns that job; Grow is for a button that becomes a form.
  • The content changes in place without a trigger. Use Swap, Crossfade or TextSwap instead.

Rules

General

Content

Avoid

Limits

Install

npx shadcn@latest add https://kaanarici.com/r/cobalt/grow.json
import { Grow } from "@/components/cobalt/ui/grow"