Storeware Docs

App UI

React components for pages the admin frames, styled only by the admin's 13 variables, so your app looks like the admin around it.

@storeware/app-ui is a small set of React components for your home, your panels and your actions' windows. They are styled by the 13 --sw-* variables the admin sends in App Bridge's welcome and nothing else, so they follow the admin's colours, corners and type, whatever they are.

Early access

The CLI and the SDK are not on npm yet, so the commands below do not run for everyone. If you would like to build an app now, tell us.
import { AppBridgeProvider } from '@storeware/app-bridge-react';
import { AppUiStyles, Button, Card, Page, Stack, TextField } from '@storeware/app-ui';

export function Home() {
  return (
    <AppBridgeProvider hostOrigin="https://app.storeware.ai">
      <AppUiStyles />
      <Page>
        <Card title="Greeting">
          <Stack>
            <TextField label="Greeting" hint="Shown above every review" name="greeting" />
            <Button variant="primary" type="submit">
              Save
            </Button>
          </Stack>
        </Card>
      </Page>
    </AppBridgeProvider>
  );
}

Put AppUiStyles once, near the root: it is the stylesheet, as a style element. AppBridgeProvider sets the variables. Without App Bridge, set them yourself with bridge.applyTheme.

Components

ComponentWhat it is
PageThe page's ground: the admin's background, text colour and typeface
CardA raised panel, with an optional title
Stack, InlineChildren above one another, or side by side; gap is tight, base or loose
HeadingA heading, level 1 to 3
TextA paragraph; tone is muted, ok, warn or bad; mono for an id or a code
Buttonvariant is primary, secondary, plain or danger
TextField, Select, CheckboxLabelled controls; hint says what goes in, error what is wrong
BadgeA short status; tone is ok, warn or bad
BannerA message across the page, read out to screen readers
SpinnerSomething on its way, with a label for screen readers; still under reduced motion
DividerA hairline
EmptyStateWhat a page shows before it has anything, with an action

Button, TextField, Select and Checkbox take the usual attributes of the element they draw, such as name, value and onChange. The stylesheet is exported as css too, if you would rather put it in your own.

The variables

VariableWhat it is
--sw-bgThe page's background
--sw-surfaceCards and anything raised
--sw-fgText
--sw-mutedSecondary text
--sw-lineHairlines and borders
--sw-accentThe primary button
--sw-accent-fgText on the primary button
--sw-ok, --sw-warn, --sw-badDone, needs a look, went wrong
--sw-radiusCorners
--sw-font-sans, --sw-font-monoText, and what a machine says

Use them in your own CSS too, as var(--sw-surface), and your own pieces will match.

On this page