AppHeader is a flexible compound component that provides a complete application header with support for multiple layouts, responsive behavior, and customizable sections including logo, app name, navigation, and action buttons.
npm install @dt-dds/react-app-headerAppHeader is a flexible compound component that provides a complete application header with support for multiple layouts, responsive behavior, and customizable sections including logo, app name, navigation, and action buttons.
``jsx
import { AppHeader } from '@dt-dds/react-app-header';
import { Icon } from '@dt-dds/react-icon';
import { IconButton } from '@dt-dds/react-icon-button';
export const App = () => {
return (
);
};
`
The main container component that manages layout and state for all child components.
| Property | Type | Default | Description |
| ---------- | ------------------------- | ---------- | --------------------------------------------------------------------------------------------------- |
| type | 'standard' \| 'compact' | standard | Determines the header layout. standard shows app name before logo, compact shows it after logo. |style
| | React.CSSProperties | - | Custom CSS properties to apply to the header container |children
| | ReactNode | - | Child components: Logo, AppName, Navigation, and Actions |
Container for the application logo. Automatically adjusts positioning based on header type and layout.
| Property | Type | Default | Description |
| ---------- | --------------------- | ------- | --------------------------------- |
| children | ReactNode | - | Logo content (typically an image) |style
| | React.CSSProperties | - | Custom CSS properties |
Displays the application name with automatic typography styling based on header type.
| Property | Type | Default | Description |
| ---------- | --------------------- | ------- | --------------------------------------------- |
| name | string | - | Application name text |children
| | ReactNode | - | Alternative to name prop for custom content |style
| | React.CSSProperties | - | Custom CSS properties |
Container for navigation links. Supports flexible positioning and responsive visibility.
| Property | Type | Default | Description |
| ---------- | ------------------------------- | -------- | ---------------------------------------------- |
| children | ReactNode | - | Navigation content (typically a list of links) |position
| | 'center' \| 'left' \| 'right' | center | Navigation position within the header |style
| | React.CSSProperties | - | Custom CSS properties |
Container for action buttons and controls (search, menu, user profile, etc.). Supports left and right positioning.
| Property | Type | Default | Description |
| ---------- | --------------------- | ------- | ------------------------------------- |
| children | ReactNode | - | Action buttons and controls |position
| | 'left' \| 'right' | right | Position of actions within the header |style
| | React.CSSProperties | - | Custom CSS properties |
#### Responsive Props
All compound components (Logo, AppName, Navigation, Actions) support responsive visibility through hide and show props:
- hide: Hides the component when the media query matches (e.g., hide={(min-width: ${theme.breakpoints.mq3}px)} hides on desktop)show
- : Shows the component only when the media query matches (e.g., show={(max-width: ${theme.breakpoints.mq3}px)} shows only on mobile)hide
- If both and show are provided, hide takes precedence
- 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
- yarn build - Build the packageyarn dev
- - Run the package locallyyarn lint
- - Lint all files within this packageyarn test
- - Run all unit testsyarn test:report
- - Open the test coverage reportyarn test:update:snapshot
- - Run all unit tests and update the snapshot
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.
`bash``
app-header
└── dist
├── index.d.ts <-- Types
├── index.js <-- CommonJS version
└── index.mjs <-- ES Modules version
...
Follows semantic versioning
Licensed under MIT License