Show
Shows its content only on some screens: wider than a breakpoint, or up to it. sm is 40rem, md 56rem, lg 74rem.
import { Show } from '@sypnia/ui/react'
A shorter label on phones
Make the window narrow and wide.
(phone)
Code
import { Button, Show } from '@sypnia/ui/react';
// Make the window narrow and wide: one line changes.
export default function Screens() {
return (
<div className="sy-row">
<Show above="md"><Button icon="download">Export as CSV</Button></Show>
<Show below="md"><Button icon="download">Export</Button></Show>
<Show below="sm" as="span"><span className="sy-text--sm sy-text--muted">(phone)</span></Show>
</div>
);
} When to use it
Use it when
- A shorter label on phones, an extra column on wide screens.
Do not use it when
- Hiding what people need on phones: fit it instead.
For everyone
- It is CSS: hidden content is also hidden from screen readers, so both versions must say the same thing.
Props
| Show | Type | Default |
|---|---|---|
above | "sm" | "md" | "lg" | |
as | ElementType | div |
below | "sm" | "md" | "lg" |