Skip to content

Commit da26384

Browse files
authored
feat(Alert.tsx): add custom role, status or alert (#443)
1 parent 1a82c7d commit da26384

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Alert.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export type AlertProps = {
3232
closable?: boolean;
3333
/** To provide if you want the Alert to be controlled */
3434
isClosed?: boolean;
35+
role?: "alert" | "status";
3536
onClose?: () => void;
3637
} & (AlertProps.DefaultSize | AlertProps.Small);
3738

@@ -73,6 +74,7 @@ export const Alert = memo(
7374
closable: isClosableByUser = false,
7475
isClosed: props_isClosed,
7576
onClose,
77+
role = "alert",
7678
...rest
7779
} = props;
7880

@@ -145,7 +147,7 @@ export const Alert = memo(
145147
className
146148
)}
147149
style={style}
148-
{...(refShouldSetRole.current && { "role": "alert" })}
150+
{...(refShouldSetRole.current && { "role": role })}
149151
ref={ref}
150152
{...rest}
151153
>

0 commit comments

Comments
 (0)