@atlaskit/heading
Version:
A heading is a typography component used to display text in different sizes and formats.
10 lines • 371 B
JavaScript
import { useHeadingLevel } from './use-heading-level';
export const useHeading = fallback => {
const hLevel = useHeadingLevel();
/**
* Order here is important, we for now apply
* 1. inferred a11y level (this only applies if context is present)
* 2. default final fallback
*/
return [hLevel, hLevel && (hLevel > 6 ? 'div' : `h${hLevel}`) || fallback];
};