We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6877032 commit d5b6324Copy full SHA for d5b6324
src/components/Container.astro
@@ -1,10 +1,14 @@
1
---
2
-interface Props {
3
- as: keyof Pick<HTMLElementTagNameMap, 'div' | 'section' | 'article' | 'header' | 'footer' | 'code'>;
4
- class?: string
5
-}
+import type { Polymorphic } from 'astro/types';
6
7
-const { as: Tag, class: className } = Astro.props;
+type LayoutTag = 'section' | 'div' | 'article' | 'header' | 'footer' | 'code';
+
+type Props<Tag extends LayoutTag> = Polymorphic<{
+ as: Tag;
8
+ class?: string;
9
+}>;
10
11
+const { as: Tag = 'div', class: className } = Astro.props as Props<LayoutTag>;
12
13
14
<Tag class:list={[
0 commit comments