Tour
A few steps that point at parts of a screen the first time someone sees it. Each step names one thing and what it is for. It never blocks the page and can be skipped at any time.
import { Tour } from '@sypnia/ui/react'
The first visit to Tables
Press «Start the tour».
Tables
Your tables will be listed here, with how many rows each has and who can read it.
Code
import { useState } from 'react';
import { Button, Panel, Tour } from '@sypnia/ui/react';
// Three steps, each pointing at one thing. Skip it at any moment with the ×.
export default function FirstVisit() {
const [open, setOpen] = useState(false);
return (
<div className="sy-stack">
<div className="sy-row">
<Button onClick={() => setOpen(true)} icon="play">Start the tour</Button>
<Button id="tour-new" variant="primary" icon="plus">New table</Button>
<Button id="tour-import" icon="import">Import CSV</Button>
</div>
<Panel title="Tables"><p id="tour-list">Your tables will be listed here, with how many rows each has and who can read it.</p></Panel>
<Tour open={open} onClose={() => setOpen(false)} steps={[
{ target: '#tour-new', title: 'Create a table', body: 'A table holds rows with the same columns: orders, customers, products.' },
{ target: '#tour-import', title: 'Or bring your data', body: 'Import a CSV and the columns are made for you.' },
{ target: '#tour-list', title: 'Everything in one list', body: 'Open a table to see its rows, change its columns or decide who can read it.' },
]} />
</div>
);
} When to use it
Use it when
- A new screen with a few parts that are not obvious.
- Three to five steps; say what each part is for, not where to click.
Do not use it when
- Explaining a screen that needs explaining: make the screen clearer first.
- Long tours: link to the docs instead.
For everyone
- Each step is a dialog named by its title; the main button has the focus.
- «Step 1 of 3» says how long it is; the × skips it.
- The page behind stays usable.
Props
| Tour | Type | Default |
|---|---|---|
onCloserequiredSkipped or closed. | () => void | |
openrequired | boolean | |
stepsrequired | TourStep[] | |
onFinishFinished the last step. Defaults to onClose. | (() => void) |