Here is a simple example demonstrating how to use a theme. To begin at the global level, you need to load and provide the theme.
import { Provider, teamsTheme } from "@fluentui/react-northstar";
import { Grid } from "@fluentui/react-northstar";
const Layout: React.FC = ({ children }) => {
return (
<Provider theme={teamsTheme}>
<Grid
columns="minmax(50px, 0.75fr) 1fr 1fr 1fr"
rows="50px 1fr"
style={{ height: "100vh" }}
>
{children}
</Grid>
</Provider>
);
};
export default Layout;
Next, create a component:
const Header: React.FC<SegmentProps> = ({children}) => {
const styledHeaderWrapper = useCSS((theme) => ({
gridColumn: "span 4",
backgroundColor: theme.siteVariables.colorScheme.brand.white,
}));
return (
<Flex
gap="gap.small"
hAlign="center"
vAlign="center"
className={styledHeaderWrapper}
>
{children}
</Flex>
);
};
export default Header;