astro/examples/component/packages/my-component/Heading.astro
Jonathan Neal 033b70a7f8
Add Component Example (#2203)
* Add Component Example

* chore(lint): Prettier fix

* nit: improve implementation

* nit: Update documentation

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2021-12-17 08:47:59 -05:00

18 lines
No EOL
260 B
Text

---
export interface Props extends Record<any, any> {
level?: number | string
role?: string
}
const {
level,
role,
...props
} = {
...Astro.props
} as Props
props.role = role || 'heading'
props['aria-level'] = level || '1'
---
<h {...props}><slot /></h>