Surface
On this page
Overview
Surfaces are content containers with a color palette which provide a theme (i.e. a background color as well as accessible font colors) to their child elements. Use surface only when other containers like card or accordion are inappropriate.
Edit element properties
#surface {
display: grid;
grid-auto-columns: 1fr;
grid-auto-flow: column;
justify-items: center;
align-items: center;
padding: var(--rh-space-xl);
}
import '@rhds/elements/rh-surface/rh-surface.js';
import '@rhds/elements/rh-blockquote/rh-blockquote.js';
import '@rhds/elements/rh-spinner/rh-spinner.js';
import '@rhds/elements/rh-tag/rh-tag.js';
<rh-surface id="surface" color-palette="darkest">
<rh-blockquote align="inline-start" size="default">
<p>Surface is used to provide a theme to children</p>
</rh-blockquote>
<rh-spinner size="lg">Loading...</rh-spinner>
<rh-tag color="green">Sold</rh-tag>
</rh-surface>
Sets color palette, which affects the element's styles as well as descendants' color theme. The default surface color palette is 'lightest', Surface always overrides the parent's color context. Your theme will influence these colors so check there first if you are seeing inconsistencies. See CSS Custom Properties for default values
Status
- Figma library:
-
Ready - RH Elements:
-
Ready - RH Shared Libs:
-
Ready
When to use
- When you want a styled background that fits well into RHDS' theming system.
- When you want to provide theming tokens to elements without using a styled container.
Status checklist
Property | Status | Meaning |
---|---|---|
Figma library |
|
Component is available in the Figma library |
RH Elements |
|
Component is available in the RH Elements repo |
RH Shared Libs |
|
Component is available in the RH Shared Libs repo |
Other libraries
To learn more about our other libraries, visit this page.
Feedback
To give feedback about anything on this page, contact us.
Other libraries
To learn more about our other libraries, visit the getting started page.