TextBreak
Render a horizontal divider line with an optional inline label and loading indicator.
TextBreak renders a full-width row with thin rule lines on either side of a text label. Use it to separate groups of options, list sections or unread messages.
Import#
import { TextBreak } from "@reactberry/system/blocks";
Usage#
import { TextBreak } from "@reactberry/system/blocks";
import { Box, Button } from "@reactberry/system/elements";
export default function SignInOptions() {
return (
<Box display="flex" flexDirection="column" gap="m" p="l">
<Button variant="default">Continue with email</Button>
<TextBreak message="or" />
<Button variant="default">Continue with SSO</Button>
</Box>
);
}
Examples#
Colour schemas#
colorSchema sets the label and line colours: "default", "attention" or "accent".
Position#
position="left" hides the left line and position="right" hides the right line, so the label sits at that edge.
Loading#
Set loading to show an animated dots icon before the label. Click the button to toggle it.
API#
TextBreak#
| Prop | Type | Default | Description |
|---|---|---|---|
message | string | — | Label text. Takes precedence over |
colorSchema | string | default |
|
loading | boolean | — | Shows an animated dots icon before the label. Only visible when there is a label. |
showBreaks | boolean | true | Renders the rule lines. |
position | "center""left""right" | "center" | Label alignment. |
children | ReactNode | — | Label content used when |
contentProps | { [key: string]: any; } | {} | Props spread onto the label wrapper. |
breakProps | { [key: string]: any; } | {} | Props spread onto each rule line. |
All remaining props are spread onto the outer Text (rendered as a div), which defaults to display="flex", width="100%", fontSize="xsmall" and gap="xsmall".
Accessibility#
TextBreakrenders plaindivelements with no role. The label is read as normal text; the lines are emptydivs and are not announced.
Notes#
- Colour schemas map to
[lineColour, textColour]:defaultistertiary/secondary,attentioniscurrentColor/red,accentiscurrentColor/accent. - Lines are 1px high with
opacity0.25. UsebreakPropsto override. - The label is not rendered when both
messageandchildrenare empty; only the lines remain. Theloadingicon is part of the label, so it is not shown either. - With
position="left"the label has no horizontal padding; otherwise it usespx="small". TextBreakPropsis not exported.