For a card with a title and actions take CdsCard, for the sections of a page take CdsLayout.
CdsSurfaceis the lowest layer, without content or paddings of its own.
Variations
Color
The color prop sets the background from the theme tokens and picks a contrasting text color. Besides surface-*, any color of the palette and any CSS color will do. Which colors exactly hide behind the tokens is decided by the theme: the theme prop switches it for the surface and for everything inside it.
Sizes
The width, height, min-width, max-width, min-height and max-height props accept a number (pixels) or a string with any CSS unit.
Positioning
The position prop sets the CSS position, location pins the surface to an edge of the container — top end, bottom start, center. Together they build a plate on top of another block.
Scenarios
A summary panel
The surface gives the background and the sizes, while the paddings and the layout inside are up to you. The tag prop changes the tag of the wrapper — here it is section, so the block stays meaningful in the structure of the page.
API
Props
| Name | Type | Default | Description |
|---|---|---|---|
color | string | undefined | — | Background color of the surface |
height | string | number | undefined | — | Component height |
location | Anchor | null | undefined | — | Position of the element relative to its container, for example "top left", "center", "bottom right". |
maxHeight | string | number | undefined | — | Maximum component height |
maxWidth | string | number | undefined | — | Maximum component width |
minHeight | string | number | undefined | — | Minimum component height |
minWidth | string | number | undefined | — | Minimum component width |
position | "absolute" | "static" | "fixed" | "relative" | "sticky" | undefined | — | CSS positioning of the component — the value of the position property |
tag | string | JSXComponent<any> | undefined | 'div' | Custom HTML tag or component to render |
theme | string | undefined | — | Component theme |
width | string | number | undefined | — | Component width |
Slots
| Name | Type | Description |
|---|---|---|
default | any | The main content of the surface. |