Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fine-ties-think.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@badrap/libapp": patch
---

Add TextBlock component
29 changes: 29 additions & 0 deletions src/ui/experimental/TextBlock.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { type Responsive, type UiNode, element } from "../internal.ts";

type TextBlockProps = {
/**
* Horizontal text alignment. Can be responsive.
* Inherited from surrounding context if not explicitly set.
*/
align?: Responsive<"left" | "center" | "right">;
/**
* Maximum number of lines to display before truncating. Can be responsive.
*/
maxLines?: Responsive<number>;
/**
* When true, reduces the text emphasis by applying a lower-intensity color variant.
*/
muted?: boolean;
/**
* The content to be displayed. Can be a string or more complex UI elements.
*/
children?: UiNode;
};

/**
* A component for rendering block-level text content.
* Color is inherited from the surrounding context.
*/
export function TextBlock(props: TextBlockProps): UiNode {
return element("ui-text-block", props);
}
1 change: 1 addition & 0 deletions src/ui/experimental/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ export { RelativeTime } from "./RelativeTime.ts";
export { Select } from "./Select.ts";
export { Switch } from "./Switch.ts";
export { Text } from "./Text.ts";
export { TextBlock } from "./TextBlock.ts";
export { TextField } from "./TextField.ts";
export { UploadButton } from "./UploadButton.ts";
Loading