react-tailwind-component-library
Version:
React component library powered by TailwindCss
89 lines • 2.61 kB
TypeScript
import React from 'react';
import PropTypes from 'prop-types';
export declare const VALID_TAGS: readonly ["h1", "h2", "h3", "h4", "h5", "h6", "p", "span", "div"];
export declare const TEXT_VARIANTS: readonly ["hero", "display", "heading", "body"];
export declare const TEXT_WEIGHTS: readonly ["bold", "medium", "regular", "light"];
export declare const TEXT_SIZES: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9];
export interface ITextProps {
/**
* Defines whether the text is displayed as hero, display, heading, or body
* @default body
*/
variant?: typeof TEXT_VARIANTS[number];
/**
* Defines whether the text is regular, bold, medium, or light
* @default regular
*/
weight?: typeof TEXT_WEIGHTS[number];
/**
* Defines size of text, with 1 being the largest and 9 being the smallest
* @default 1
*/
size?: typeof TEXT_SIZES[number];
}
export declare const textPropTypes: {
variant: PropTypes.Requireable<"body" | "display" | "heading" | "hero">;
weight: PropTypes.Requireable<"bold" | "light" | "medium" | "regular">;
size: PropTypes.Requireable<5 | 6 | 4 | 1 | 3 | 2 | 9 | 7 | 8>;
};
export interface TextProps extends ITextProps {
/**
* Defines optional id for the text element
*/
id?: string;
/**
* Defines tag for the text element, like `p`, `h1`, `h2`, etc.
*/
tag?: typeof VALID_TAGS[number];
/**
* Uses italic text if provided
*/
italic?: boolean;
/**
* Defines if the text takes additional classnames from parent element
*/
className?: string;
/**
* Defines any aria role attribute
*/
role?: string;
/**
* Defines alternate text (for icons)
*/
alt?: string;
/**
* Defines if this text will be used as a link
*/
link?: boolean;
/**
* Defines if the text appears as clickable link
*/
clickable?: boolean;
/**
* Defines if clicking on this text fires an event
*/
onClick?: () => void;
/**
* Defines if this text will be used as a link
*/
href?: string;
/**
* Defines if it links to external page, should open in new tab/window
*/
external?: boolean;
/**
* Hide external link icon
*/
hideExternalLinkIcon?: boolean;
/**
* Attributes to Cypress integration
*/
'data-cy'?: string;
/**
* React children to this component which defines the text to be shown
*/
children?: React.ReactNode;
}
declare const Text: React.FC<TextProps>;
export default Text;
//# sourceMappingURL=Text.d.ts.map