Expandable textPro
Long text clamped to a few lines with a soft fade; Read more glides open, Show less closes, and the toggle only appears when the text overflows.
oxyn add expandable-textThe agent read 14 files, ran the test suite three times and traced the flaky failure to a clock skew in the token validator: tokens minted in the last second of a minute were rejected when the check ran a few milliseconds later.
The fix adds a 30 second leeway to the expiry check and a regression test that freezes the clock at 59.999 seconds. All 148 tests pass, including the new one, across three consecutive runs.
No other call sites depend on the strict check. The change is two lines in auth/token.rs and one new test.
The preview stays free for everyone. Pro opens the code of every Pro component, screen, agent-app template, block and kit, plus the Pro CLI.
Rendered from Rust at build time · goes live when visible
When to use
- Long run summaries, descriptions and message bodies that should not push everything else down.
When not to use
- Supporting detail revealed in place: use Accordion instead.
- Feedback on a reply: use Response feedback instead.
- An app sidebar: use Sidebar instead.
Installation
Expandable text is part of Oxyn Pro; the preview is free. Pro items install with the oxyn CLI once your licence is signed in; until then Pro members copy the code from this page.
oxyn add expandable-textUsage
The preview is free. Pro opens the code of every Pro component, screen and template.
Examples
Summary
A run summary clamped to three lines.
The agent read 14 files, ran the test suite three times and traced the flaky failure to a clock skew in the token validator: tokens minted in the last second of a minute were rejected when the check ran a few milliseconds later.
The fix adds a 30 second leeway to the expiry check and a regression test that freezes the clock at 59.999 seconds. All 148 tests pass, including the new one, across three consecutive runs.
No other call sites depend on the strict check. The change is two lines in auth/token.rs and one new test.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
One line
One line without the fade.
The agent read 14 files, ran the test suite three times and traced the flaky failure to a clock skew in the token validator: tokens minted in the last second of a minute were rejected when the check ran a few milliseconds later.
The fix adds a 30 second leeway to the expiry check and a regression test that freezes the clock at 59.999 seconds. All 148 tests pass, including the new one, across three consecutive runs.
No other call sites depend on the strict check. The change is two lines in auth/token.rs and one new test.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Labels
Custom labels.
The agent read 14 files, ran the test suite three times and traced the flaky failure to a clock skew in the token validator: tokens minted in the last second of a minute were rejected when the check ran a few milliseconds later.
The fix adds a 30 second leeway to the expiry check and a regression test that freezes the clock at 59.999 seconds. All 148 tests pass, including the new one, across three consecutive runs.
No other call sites depend on the strict check. The change is two lines in auth/token.rs and one new test.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
API reference
ExpandableText
| Prop | Type | Default | Description |
|---|---|---|---|
textrequired | String | — | The text (paragraphs split on blank lines). |
lines | u32 | 3 | Lines while collapsed. |
expanded | bool | Default::default() | Start open. |
more_label | String | "Read more" | Toggle label while collapsed. |
less_label | String | "Show less" | Toggle label while open. |
fade | bool | true | Fade over the last line. |
on_change | EventHandler<bool> | — | Open state changed. |
Read from the Rust signature and doc comments.
Keyboard interactions
| Key | Action |
|---|---|
| EnterorSpace | Open or close from the toggle |
Accessibility
- The clamp is visual: the whole text stays in the accessibility tree.
- The toggle has aria-expanded and aria-controls; labels crossfade in one cell.
From the spec
The whole text stays in the accessibility tree; the toggle has aria-expanded and aria-controls; the hidden label is aria-hidden.
Motion & interaction
Height and the fade move together on a soft ease; the two labels crossfade in one cell with a short drift and blur; the chevron flips.
Timing
| Transition | Duration | Easing | Reduced motion |
|---|---|---|---|
| Open | 560 ms | cubic-bezier(.32,.5,.2,1) | instant |
| Close | 420 ms | same | instant |
| Label crossfade | 160–200 ms | ease.out | instant |
Responsive behaviour
- The clamp is plain CSS, so width and font changes need no script.
Edge cases (spec)
The toggle is measured: short text never shows it. The clamp is plain CSS so resizes need no script.
Notes for AI
- Import
ExpandableTextfromoxyn_dioxusand includePRIMITIVES_CSSplus the token stylesheet once. - A GPUI version exists:
ExpandableTextElinoxyn_gpui. - Props to set first:
text. - Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.