astro/examples/component/packages/my-component/Heading.astro

16 lines
265 B
Text
Raw Permalink Normal View History

---
export interface Props extends Record<any, any> {
2021-12-22 21:11:05 +00:00
level?: number | string;
role?: string;
}
2021-12-22 21:11:05 +00:00
const { level, role, ...props } = {
...Astro.props,
} as Props;
2021-12-22 21:11:05 +00:00
props.role = role || 'heading';
props['aria-level'] = level || '1';
---
2021-12-22 21:11:05 +00:00
<h {...props}><slot /></h>