Styling
Loading
Applying styles to components or application specific content and functionality can be achieved by the following methods.
The css function accepts object styles directly and does not require an additional import.
1<div2 css={{3 backgroundColor: 'hotpink',4 '&:hover': {5 color: 'lightgreen'6 }7 }}8>9 This has a hotpink background.10</div>
Global styles can be applied via 'Global' and is used with a styles prop which accepts the same values as the css prop except it inserts styles globally. Global styles are also removed when the styles change or when the Global component unmounts.
1import { Global } from '@emotion/react'23render(4<div>5 <Global styles={{ fontSize: var(--s4), textAlign: 'center' }} />6</div>7)
The Box component along with the other layout components can be used as general purpose containers to apply a wide range of styling to content, the available styling variables are linked to the foundation tokens to ensure the design system theme is applied as intended.
1<Box backgroundColor="tertiary" color="text" padding="--s3" borderY borderColor="form" borderWidth="large">2 <p>Content goes here</p>3</Box>