UNPKG

@primer/react-brand

Version:

Primer Brand is a GitHub's design system for creating React-based marketing websites and digital experiences.

63 lines (62 loc) 2.53 kB
import React, { PropsWithChildren } from 'react'; import { BaseProps } from '../component-helpers'; export declare const TextSizes: readonly ["1000", "900", "800", "700", "600", "500", "400", "350", "300", "200", "100"]; export declare const TextTags: readonly ["p", "span", "div", "strong", "em"]; export declare const TextVariants: readonly ["default", "muted"]; export declare const TextWeights: readonly ["heavy", "extrabold", "bold", "semibold", "medium", "normal", "light", "extralight"]; export declare const TextFontVariants: readonly ["mona-sans", "hubot-sans", "monospace"]; export declare const defaultTextTag: "span"; export declare const defaultTextSize: "200"; export declare const defaultTextVariant: "default"; export declare const defaultFontVariant: "mona-sans"; export type TextWeightVariants = (typeof TextWeights)[number]; export type TextFontVariants = (typeof TextFontVariants)[number]; export type ResponsiveWeightMap = { narrow?: TextWeightVariants; regular?: TextWeightVariants; wide?: TextWeightVariants; }; type RestrictedPolymorphism = (React.HTMLAttributes<HTMLParagraphElement> & BaseProps<HTMLParagraphElement> & { as?: 'p'; }) | (React.HTMLAttributes<HTMLSpanElement> & BaseProps<HTMLSpanElement> & { as?: 'span'; }) | (React.HTMLAttributes<HTMLDivElement> & BaseProps<HTMLDivElement> & { as?: 'div'; }) | (React.HTMLAttributes<HTMLElement> & BaseProps<HTMLElement> & { as?: 'strong'; }) | (React.HTMLAttributes<HTMLElement> & BaseProps<HTMLElement> & { as?: 'em'; }); type TextTags = { /** * Applies the underlying HTML element */ as?: (typeof TextTags)[number]; } & RestrictedPolymorphism; export type TextProps = { font?: TextFontVariants; /** * Specify the text size */ size?: (typeof TextSizes)[number]; /** * Specify alternative text appearance */ variant?: (typeof TextVariants)[number]; /** * Specify the text weight */ weight?: TextWeightVariants | ResponsiveWeightMap; /** * Specify the text alignment. * Corresponds to the CSS `text-align` property. * Note: Only applies to block elements. */ align?: 'start' | 'center' | 'end'; /** * Toggle antialiasing on or off */ hasAntiAliasing?: boolean; } & TextTags; export declare function Text({ align, animate, as, className, children, font, size, variant, weight, style, hasAntiAliasing, ...rest }: PropsWithChildren<TextProps>): import("react/jsx-runtime").JSX.Element; export {};