Skip to content

Commit bef47b9

Browse files
fix: add anchor element attribute types to IconButton (#18597)
* fix: add anchor element attribute types to IconButton * fix: update public api --------- Co-authored-by: Heloise Lui <71858203+heloiselui@users.noreply.github.com>
1 parent 9e7ce8b commit bef47b9

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4264,6 +4264,9 @@ Map {
42644264
"leaveDelayMs": Object {
42654265
"type": "number",
42664266
},
4267+
"rel": Object {
4268+
"type": "string",
4269+
},
42674270
"size": Object {
42684271
"args": Array [
42694272
Array [
@@ -4274,6 +4277,9 @@ Map {
42744277
],
42754278
"type": "oneOf",
42764279
},
4280+
"target": Object {
4281+
"type": "string",
4282+
},
42774283
"wrapperClasses": Object {
42784284
"type": "string",
42794285
},

packages/react/src/components/IconButton/index.tsx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export interface IconButtonProps
8080
/**
8181
* Optionally specify an href for your IconButton to become an `<a>` element
8282
*/
83-
href?: string;
83+
href?: React.AnchorHTMLAttributes<HTMLAnchorElement>['href'];
8484

8585
/**
8686
* Provide an icon or asset to be rendered inside of the IconButton
@@ -146,11 +146,21 @@ export interface IconButtonProps
146146
*/
147147
leaveDelayMs?: number;
148148

149+
/**
150+
* Optionally specify a `rel` when using an `<a>` element.
151+
*/
152+
rel?: React.AnchorHTMLAttributes<HTMLAnchorElement>['rel'];
153+
149154
/**
150155
* Specify the size of the Button. Defaults to `md`.
151156
*/
152157
size?: ButtonSize;
153158

159+
/**
160+
* Optionally specify a `target` when using an `<a>` element.
161+
*/
162+
target?: React.AnchorHTMLAttributes<HTMLAnchorElement>['target'];
163+
154164
/**
155165
* Specify an optional className to be added to your Tooltip wrapper
156166
*/
@@ -340,11 +350,21 @@ IconButton.propTypes = {
340350
*/
341351
leaveDelayMs: PropTypes.number,
342352

353+
/**
354+
* Optionally specify a `rel` when using an `<a>` element.
355+
*/
356+
rel: PropTypes.string,
357+
343358
/**
344359
* Specify the size of the Button. Defaults to `md`.
345360
*/
346361
size: PropTypes.oneOf(['sm', 'md', 'lg']),
347362

363+
/**
364+
* Optionally specify a `target` when using an `<a>` element.
365+
*/
366+
target: PropTypes.string,
367+
348368
/**
349369
* Specify an optional className to be added to your Tooltip wrapper
350370
*/

0 commit comments

Comments
 (0)