diff --git a/docs/components/badge.md b/docs/components/badge.md
index 6d7566b8..758c2f54 100644
--- a/docs/components/badge.md
+++ b/docs/components/badge.md
@@ -24,6 +24,8 @@ Set the `type` attribute to change the badge's type.
### Pill Badges
+Use the `pill` attribute to give badges rounded edges.
+
```html preview
Primary
Success
@@ -32,6 +34,26 @@ Set the `type` attribute to change the badge's type.
Danger
```
+### Pulsating Badges
+
+Use the `pulse` attribute to draw attention to the badge with a subtle animation.
+
+```html preview
+
+ 1
+ 1
+ 1
+ 1
+ 1
+
+
+
+```
+
### With Buttons
One of the most common use cases for badges is attaching them to buttons. To make this easier, badges will be automatically positioned at the top-right when they're a child of a button.
diff --git a/src/components.d.ts b/src/components.d.ts
index d86a965a..c36be66d 100644
--- a/src/components.d.ts
+++ b/src/components.d.ts
@@ -51,6 +51,10 @@ export namespace Components {
* Set to true to draw a pill-style badge with rounded edges.
*/
"pill": boolean;
+ /**
+ * Set to true to make the badge pulsate to draw attention.
+ */
+ "pulse": boolean;
/**
* The badge's type.
*/
@@ -1184,6 +1188,10 @@ declare namespace LocalJSX {
* Set to true to draw a pill-style badge with rounded edges.
*/
"pill"?: boolean;
+ /**
+ * Set to true to make the badge pulsate to draw attention.
+ */
+ "pulse"?: boolean;
/**
* The badge's type.
*/
diff --git a/src/components/badge/badge.scss b/src/components/badge/badge.scss
index d6774136..131d46c3 100644
--- a/src/components/badge/badge.scss
+++ b/src/components/badge/badge.scss
@@ -49,9 +49,54 @@
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// Pill modifiers
+// Pill modifier
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
.badge--pill {
border-radius: var(--sl-border-radius-pill);
}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Pulse modifier
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+.badge--pulse {
+ animation: pulse 1.5s infinite;
+}
+
+.badge--pulse.badge--primary {
+ --pulse-hue: var(--sl-color-primary-hue);
+ --pulse-saturation: var(--sl-color-primary-saturation);
+}
+
+.badge--pulse.badge--success {
+ --pulse-hue: var(--sl-color-success-hue);
+ --pulse-saturation: var(--sl-color-success-saturation);
+}
+
+.badge--pulse.badge--info {
+ --pulse-hue: var(--sl-color-info-hue);
+ --pulse-saturation: var(--sl-color-info-saturation);
+}
+
+.badge--pulse.badge--warning {
+ --pulse-hue: var(--sl-color-warning-hue);
+ --pulse-saturation: var(--sl-color-warning-saturation);
+}
+
+.badge--pulse.badge--danger {
+ --pulse-hue: var(--sl-color-danger-hue);
+ --pulse-saturation: var(--sl-color-danger-saturation);
+}
+
+@keyframes pulse {
+ 0% {
+ box-shadow: 0 0 0 0 hsla(var(--pulse-hue), var(--pulse-saturation), 50%, 0.75);
+ }
+ 70% {
+ box-shadow: 0 0 0 0.5rem hsla(var(--pulse-hue), var(--pulse-saturation), 50%, 0);
+ }
+ 100% {
+ box-shadow: 0 0 0 0 hsla(var(--pulse-hue), var(--pulse-saturation), 50%, 0);
+ }
+}
diff --git a/src/components/badge/badge.tsx b/src/components/badge/badge.tsx
index 5ac77a44..e9692225 100644
--- a/src/components/badge/badge.tsx
+++ b/src/components/badge/badge.tsx
@@ -23,6 +23,9 @@ export class Badge {
/** Set to true to draw a pill-style badge with rounded edges. */
@Prop() pill = false;
+ /** Set to true to make the badge pulsate to draw attention. */
+ @Prop() pulse = false;
+
render() {
return (