@atlaskit/primitives
Version:
Primitives are token-backed low-level building blocks.
58 lines (57 loc) • 1.88 kB
TypeScript
/** @jsx jsx */
import { FC, ReactNode } from 'react';
import { BodyText, TextColor, UiText } from '../xcss/style-maps.partial';
import type { BasePrimitiveProps } from './types';
declare const asAllowlist: readonly ["span", "p", "strong", "em"];
type AsElement = (typeof asAllowlist)[number];
type Variant = BodyText | UiText;
export interface TextProps extends Omit<BasePrimitiveProps, 'xcss'> {
/**
* HTML tag to be rendered. Defaults to `span`.
*/
as?: AsElement;
/**
* Elements rendered within the Text element
*/
children: ReactNode;
/**
* Text variant
*/
variant?: Variant;
/**
* Token representing text color with a built-in fallback value.
* Will apply inverse text color automatically if placed within a Box with backgroundColor.
*
*/
color?: TextColor;
/**
* The HTML id attribute https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
*/
id?: string;
/**
* Truncates text with an ellipsis when text overflows its parent container
* (i.e. `width` has been set on parent that is shorter than text length).
*/
shouldTruncate?: boolean;
/**
* Text align https://developer.mozilla.org/en-US/docs/Web/CSS/text-align
*/
textAlign?: TextAlign;
}
type TextAlign = keyof typeof textAlignMap;
declare const textAlignMap: {
center: import("@emotion/react").SerializedStyles;
end: import("@emotion/react").SerializedStyles;
start: import("@emotion/react").SerializedStyles;
};
/**
* __Text__
*
* Text is a primitive component that has the Atlassian Design System's design guidelines baked in.
* This includes considerations for text attributes such as color, font size, font weight, and line height.
* It renders a `span` by default.
*
* @internal
*/
declare const Text: FC<TextProps>;
export default Text;