Clamp
import { Clamp } from "@arcadia/ui";make test
$ make test bun test v1.4.5 src/lib/format.test.ts: passed 24 tests src/lib/day.test.ts: passed 11 tests src/lib/near.test.ts: failed 1 test expected 41.2 to be near 41.4 24 files, 188 tests, 1 failure
10 lines
Clamp
linesrequired- number
- The lines kept while closed, in the content's own text: the block takes that height.
morerequired- string
- The words on the control while closed ("Show all 40 lines", "Show full description").
lessrequired- string
- Its words while open ("Show less").
align- "start" | "end"
- Default:
"start" - Which end stands while closed. Default "start": a paragraph keeps its first lines. "end" keeps the last lines: a job's last output, read from its end.
control- "button" | "text"
- Default:
"button" - The control: a ghost button under the block, or a text button in the row its note and trailing controls share.
scroll- boolean
- Default:
false - While open, the block scrolls above --clamp-open-max instead of growing with its content.
follow- boolean
- Default:
false - Its end stays in view while the content grows, until the reader scrolls away: a job still writing. Needs scroll.
note- ReactNode
- What goes before the control in its row, in the quiet ink: what the content is, how much of it there is. Only with control="text".
trailing- ReactNode
- What goes after the control in its row: a Copy button, a link. Only with control="text".
label- string
- Default:
"More" - What the scrolling block is, for assistive tech ("Output text").
open- boolean
- Open, controlled.
defaultOpen- boolean
- Default:
false - Open before the person asks.
onOpenChange- (open: boolean, details: OpenChangeDetails) => void
- Called when the person opens or closes it.
hold- (change: () => void, anchor: Element | null) => void
- Default:
(change) => change() - Wraps each change Clamp makes to open or close, given the box to keep in view: a product's scroll keeper holds the reader's place across it. Omit it and the change runs at once.
rootStyle- ClampStyle
- Typed StyleX override: where it sits and its knobs.
childrenrequired- ReactNode
- What it holds.
State machine
Read the project brief
Find the draft
Check the references
Review the changes
Run the checks
Send for review
Find the draft
Check the references
Review the changes
Run the checks
Send for review