Surface
Use the Surface component to structure and visually separate content on a page, or to create floating overlays such as menus, selects, and modals.
Import
import { Surface } from '@dynatrace/strato-components/layouts';
Demo
The Surface component offers different visual styles depending on the elevation level. By default, the elevation is set to flat.
Use selection style
The selection style can be set to different color values. By default, it's set to neutral. Always consider the meaning of the color if you change it. The color also defines the color of the focus style applied when a Surface is interactive and focused.
Make interactive
Sometimes the surface should be interactive. Polymorphing it into a button or link usually works best. However, don't nest other interactive elements inside an interactive surface, as this creates accessibility issues.
Note that the surface isn't automatically interactive when a tabIndex of 0 is set. In this case, focus styles are applied but other interactive styling isn't applied automatically.
Polymorph component
By default, Surface is rendered as a standard div element. For layouting, the component can be polymorphed to any other component. This can be used, for example, to create a Flex layout inside the component. You can also polymorph a surface into an interactive element, such as a button or link, if users should interact with it.
Add layout styles
Surface has a default padding of 24px. This can be changed by setting any padding prop on the container. Similarly, the container accepts any CSS margin or layout props, such as width or height.