Skip to content

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'

On this page
  1. A shorter label on phones
  2. When to use it
  3. For everyone
  4. Props

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

ShowTypeDefault
above "sm" | "md" | "lg"
as ElementType div
below "sm" | "md" | "lg"
  1. A shorter label on phones
  2. When to use it
  3. For everyone
  4. Props

    Search pages, sections and terms