@metamask/snaps-sdk
Version:
A library containing the core functionality for building MetaMask Snaps
64 lines • 2.15 kB
text/typescript
import type { StandardFormattingElement } from "./formatting/index.cjs";
import type { IconElement } from "./Icon.cjs";
import type { LinkElement } from "./Link.cjs";
import type { SkeletonElement } from "./Skeleton.cjs";
import type { SnapsChildren } from "../component.cjs";
/**
* The children of the {@link Text} component.
*/
export type TextChildren = SnapsChildren<string | StandardFormattingElement | LinkElement | IconElement | SkeletonElement>;
/**
* The colors available to the Text {@link Text} component.
*/
export type TextColors = 'default' | 'alternative' | 'muted' | 'error' | 'success' | 'warning';
/**
* The props of the {@link Text} component.
*
* @property children - The text to display.
* @property alignment - The alignment of the text.
* @property color - The color of the text.
* @property size - The size of the text. Defaults to `md`.
* @property fontWeight - The font weight of the text. Defaults to `regular`.
*/
export type TextProps = {
children: TextChildren;
alignment?: 'start' | 'center' | 'end' | undefined;
color?: TextColors | undefined;
size?: 'sm' | 'md' | undefined;
fontWeight?: 'regular' | 'medium' | 'bold' | undefined;
};
/**
* A text component, which is used to display text.
*
* @param props - The props of the component.
* @param props.alignment - The alignment of the text.
* @param props.color - The color of the text.
* @param props.children - The text to display.
* @param props.size - The size of the text. Defaults to `md`.
* @param props.fontWeight - The font weight of the text. Defaults to `regular`.
* @returns A text element.
* @example
* <Text>
* Hello <Bold>world</Bold>!
* </Text>
* @example
* <Text alignment="end">
* Hello <Bold>world</Bold>!
* </Text>
* @example
* <Text size="sm">
* Hello <Bold>world</Bold>!
* </Text>
* @example
* <Text fontWeight="medium">
* Hello <Bold>world</Bold>!
* </Text>
*/
export declare const Text: import("../component.cjs").SnapComponent<TextProps, "Text">;
/**
* A text element.
*
* @see Text
*/
export type TextElement = ReturnType<typeof Text>;
//# sourceMappingURL=Text.d.cts.map