@dt-dds/react-typography
v1.0.0-beta.50
Published
Typography is an essential aspect of design, influencing how users perceive and interact with content. In digital interfaces, a well-crafted typography component plays a crucial role in enhancing readability, accessibility, and overall user experience.
Readme
Typography Package
Typography is an essential aspect of design, influencing how users perceive and interact with content. In digital interfaces, a well-crafted typography component plays a crucial role in enhancing readability, accessibility, and overall user experience.
Typography Usage
import { Typography } from '@dt-dds/react-typography';
export const App = () => {
return (
<Typography element='h1' fontStyles='h1' color='grey_200'>
Some text
</Typography>
);
};Properties
| Property | Type | Default | Description |
| ------------ | --------------------------------------------------------------------------- | ----------------- | ------------------------------------------------------------------------------------------------------- |
| children | ReactNode | - | Child components to be rendered |
| element | Elements | p | HTML tag to be rendered |
| color | keyof Theme['colors'] | keyof Theme['palette'] | 'unset' | 'inherit' | content.default | Sets the text color. Supports theme tokens (e.g., grey_100) or contextual keys (e.g., primary.default). |
| fontStyles | keyof Theme['fontStyles']; | - | Applies a predefined theme font style (e.g., 'h1', 'bodyLgBold'). |
| dataTestId | string | typography | A test identifier applied to the element. |
| style | React.CSSProperties | - | Inline styles for custom overrides. |
| ref | RefObject | - | Reference to the underlying DOM node. |
| ...rest | ComponentPropsWithoutRef<E> & BaseProps | — | Additional native HTML attributes for the chosen element. |
| |
Stack
- TypeScript for static type checking
- React — JavaScript library for user interfaces
- Emotion — for writing css styles with JavaScript
- Storybook — UI component environment powered by Vite
- Jest - JavaScript Testing Framework
- React Testing Library - to test UI components in a user-centric way
- ESLint for code linting
- Prettier for code formatting
- Tsup — TypeScript bundler powered by esbuild
- Yarn from managing packages
Commands
yarn build- Build the packageyarn dev- Run the package locallyyarn lint- Lint all files within this packageyarn testRun all unit tests
Compilation
Running yarn build from the root of the package will use tsup to compile the raw TypeScript and React code to plain JavaScript.
The /dist folder contains the compiled output.
typography
└── dist
├── index.d.ts <-- Types
├── index.js <-- CommonJS version
└── index.mjs <-- ES Modules version
...Versioning
Follows semantic versioning
© License
Licensed under MIT License
