Skip to content

Commit 3dd3b8b

Browse files
authored
Merge pull request #43 from badrap/text-block
feat: add TextBlock component
2 parents 8023e23 + 09e231d commit 3dd3b8b

3 files changed

Lines changed: 35 additions & 0 deletions

File tree

.changeset/fine-ties-think.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@badrap/libapp": patch
3+
---
4+
5+
Add TextBlock component

src/ui/experimental/TextBlock.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { type Responsive, type UiNode, element } from "../internal.ts";
2+
3+
type TextBlockProps = {
4+
/**
5+
* Horizontal text alignment. Can be responsive.
6+
* Inherited from surrounding context if not explicitly set.
7+
*/
8+
align?: Responsive<"left" | "center" | "right">;
9+
/**
10+
* Maximum number of lines to display before truncating. Can be responsive.
11+
*/
12+
maxLines?: Responsive<number>;
13+
/**
14+
* When true, reduces the text emphasis by applying a lower-intensity color variant.
15+
*/
16+
muted?: boolean;
17+
/**
18+
* The content to be displayed. Can be a string or more complex UI elements.
19+
*/
20+
children?: UiNode;
21+
};
22+
23+
/**
24+
* A component for rendering block-level text content.
25+
* Color is inherited from the surrounding context.
26+
*/
27+
export function TextBlock(props: TextBlockProps): UiNode {
28+
return element("ui-text-block", props);
29+
}

src/ui/experimental/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@ export { RelativeTime } from "./RelativeTime.ts";
2121
export { Select } from "./Select.ts";
2222
export { Switch } from "./Switch.ts";
2323
export { Text } from "./Text.ts";
24+
export { TextBlock } from "./TextBlock.ts";
2425
export { TextField } from "./TextField.ts";
2526
export { UploadButton } from "./UploadButton.ts";

0 commit comments

Comments
 (0)