diff --git a/docs/docs/components/card.md b/docs/docs/components/card.md
index d1cd32a64..87a99abc2 100644
--- a/docs/docs/components/card.md
+++ b/docs/docs/components/card.md
@@ -177,8 +177,23 @@ Use the `size` attribute to change a card's size.
-
```
-
+### Appearance
+
+Use the `appearance` attribute to change the card's visual appearance.
+
+```html {.example}
+
+
+ Outlined (default)
+ Card content.
+
+{% for appearance in ['outlined filled', 'outlined accent', 'plain', 'filled', 'accent'] -%}
+
+ {{ appearance | capitalize }}
+ Card content.
+
+{%- endfor %}
+
+```
diff --git a/src/components/card/card.css b/src/components/card/card.css
index 8be8a0d9a..8b2f193f9 100644
--- a/src/components/card/card.css
+++ b/src/components/card/card.css
@@ -5,15 +5,15 @@
--spacing: var(--wa-space);
--border-width: var(--wa-panel-border-width);
- --border-color: var(--wa-color-surface-border);
+ --outlined-border-color: var(--wa-color-surface-border);
--border-radius: var(--wa-panel-border-radius);
-
--inner-border-radius: calc(var(--border-radius) - var(--border-width));
+ --inner-border-color: var(--outlined-border-color);
display: flex;
flex-direction: column;
- background-color: var(--wa-color-surface-default);
- border-color: var(--border-color);
+ background-color: var(--background-color, var(--wa-color-surface-default));
+ border-color: var(--border-color, var(--wa-color-surface-border));
border-radius: var(--border-radius);
border-style: var(--wa-panel-border-style);
box-shadow: var(--wa-shadow-s);
@@ -21,6 +21,20 @@
color: var(--wa-color-text-normal);
}
+:host(:is([appearance~='accent'], .wa-accent)) {
+ color: var(--text-color, var(--wa-color-text-normal));
+}
+
+:host([appearance~='filled']),
+:host(.wa-filled) {
+ --inner-border-color: oklab(from var(--outlined-border-color) l a b / 65%);
+}
+
+:host([appearance='plain']) {
+ --inner-border-color: transparent;
+ box-shadow: none;
+}
+
/* Take care of top and bottom radii */
.image,
:host(:not([with-image])) .header,
@@ -49,7 +63,7 @@
.header {
display: block;
border-block-end-style: inherit;
- border-block-end-color: var(--border-color);
+ border-block-end-color: var(--inner-border-color);
border-block-end-width: var(--border-width);
padding: calc(var(--spacing) / 2) var(--spacing);
}
@@ -62,7 +76,7 @@
.footer {
display: block;
border-block-start-style: inherit;
- border-block-start-color: var(--border-color);
+ border-block-start-color: var(--inner-border-color);
border-block-start-width: var(--border-width);
padding: var(--spacing);
}
diff --git a/src/components/card/card.ts b/src/components/card/card.ts
index 2c9317d9a..6bf2693ce 100644
--- a/src/components/card/card.ts
+++ b/src/components/card/card.ts
@@ -2,6 +2,7 @@ import { html } from 'lit';
import { customElement, property } from 'lit/decorators.js';
import { HasSlotController } from '../../internal/slot.js';
import WebAwesomeElement from '../../internal/webawesome-element.js';
+import appearanceStyles from '../../styles/utilities/appearance.css';
import sizeStyles from '../../styles/utilities/size.css';
import styles from './card.css';
@@ -22,19 +23,24 @@ import styles from './card.css';
* @csspart footer - The container that wraps the card's footer.
*
* @cssproperty [--border-radius=var(--wa-panel-border-radius)] - The radius for the card's corners. Expects a single value.
- * @cssproperty [--border-color=var(--wa-color-surface-border)] - The color of the card's borders, including inner borders. Expects a single value.
+ * @cssproperty [--border-color=var(--wa-color-surface-border)] - The color of the card's borders. Expects a single value.
+ * @cssproperty [--inner-border-color=var(--wa-color-surface-border)] - The color of the card's inner borders, e.g. those separating headers and footers from the main content. Expects a single value.
* @cssproperty [--border-width=var(--wa-panel-border-width)] - The width of the card's borders. Expects a single value.
* @cssproperty [--spacing=var(--wa-space)] - The amount of space around and between sections of the card. Expects a single value.
*/
@customElement('wa-card')
export default class WaCard extends WebAwesomeElement {
- static shadowStyle = [sizeStyles, styles];
+ static shadowStyle = [sizeStyles, appearanceStyles, styles];
private readonly hasSlotController = new HasSlotController(this, 'footer', 'header', 'image');
/** The component's size. Will be inherited by any descendants with a `size` attribute. */
@property({ reflect: true, initial: 'medium' }) size: 'small' | 'medium' | 'large' | 'inherit' = 'inherit';
+ /** The card's visual appearance. */
+ @property({ reflect: true })
+ appearance: 'accent' | 'filled' | 'outlined' | 'plain' = 'outlined';
+
/** Renders the card with a header. Only needed for SSR, otherwise is automatically added. */
@property({ attribute: 'with-header', type: Boolean, reflect: true }) withHeader = false;