Surface
Surface is a quiet region of the page that holds other things, such as a group of cards.
A Surface is a region of the page that other things sit on. Where a Card is an object, a Surface is the area that holds objects. It has a fill that is slightly different from the page, a thin border and a rounded corner, and it casts no shadow.
Use a Surface for a bounded area that holds several cards, such as a board or a gallery. You can also use one inside a card for a quieter region, such as a code sample, a key or a group of settings. For a single thing that people read, open or press, use a Card.
The fill has one fixed value for light mode and one for dark mode. In dark mode the fill is very close to the page, so the border does most of the work of showing where the region is.
size sets the padding and the corner, and matches a Card at the same size. When a Surface sits inside a Card or another Surface, its corner shrinks automatically so it follows the outer corner. The Surface clips its content to that corner, and a child can reach the edge with m="bleed".
A Surface is always opaque, so a card placed on it is solid even inside a backdrop region. A child that sets its own backdrop still uses the theme's material. A Surface has no keyboard behaviour of its own, and render lets you choose its element, such as a <section>.
- Card when one object needs to stand apart, such as a project or a plan.
Props
Generated from the types. It lists what this component DECLARES: a prop that arrives from a shared type or from the platform is real and is not repeated here.
| Prop | Type | What it does |
|---|---|---|
className? | string | Your classes, appended to the ones this component resolves rather than replacing them. |
render? | RenderElement | Renders the surface as a different element, such as a <section>, an <aside> or a layout component. |
size? | "1" | "2" | "3" | "4" | The size step of the surface, from 1 to 4. |
style? | React.CSSProperties | Inline styles, merged last, so your value wins over anything the component resolved. |
It also takes every prop of a <div>.
- A fill or an edge prop — With a choice of fill and border, a Surface could be made to look like a Card, and you would have two ways to build the same thing. The fill and the border are fixed.
- A border toggle — A Surface with a border and one without would mean the same thing, and in dark mode the border is most of what makes the region visible at all.
materialandbackdrop— Glass is for something that sits over other content, and a Surface is part of the page rather than over it. A child that setsbackdropstill uses the theme's material.- Tone, emphasis and a shadow — A Surface is a container, so it has no rank among its neighbours, and because it is part of the page rather than raised above it, it casts no shadow.