Skip to content

Commit f18661f

Browse files
authoredAug 16, 2024··
Types - Added Better Typings for Width, Height + Size (#219)
* added string to union type for height, width and size * added changeset * Updated docs with new props
1 parent a4ff873 commit f18661f

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed
 

‎.changeset/nine-poems-teach.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"astro-icon": patch
3+
---
4+
5+
Added better typings for height, width and size to accept non-number values (i.e. 2 rem)

‎packages/core/components/Icon.astro

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ interface Props extends HTMLAttributes<"svg"> {
1111
name: Icon;
1212
"is:inline"?: boolean;
1313
title?: string;
14-
size?: number;
15-
width?: number;
16-
height?: number;
14+
size?: number | string;
15+
width?: number | string;
16+
height?: number | string;
1717
}
1818
1919
class AstroIconError extends Error {

‎packages/www/src/content/docs/guides/components.mdx

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ interface Props extends HTMLAttributes<"svg"> {
3131
/** Shorthand for including a <title>{props.title}</title> element in the SVG */
3232
title?: string;
3333
/** Shorthand for setting width and height */
34-
size?: number;
35-
width?: number;
36-
height?: number;
34+
size?: number | string;
35+
width?: number | string;
36+
height?: number | string;
3737
}
3838
```
3939

0 commit comments

Comments
 (0)
Please sign in to comment.