Components

Empty

What a list shows before it has anything in it.

Previews are drawn in the theme you made.

Edit it
media
frame
tone
size
scheme
direction

No results #

No results for “invoices 2019”

Check the spelling, or search every folder.

import { Button, Empty, EmptySlots, Recipes } from 'foldkit-mixins-ui'
import { example } from '../../gallery/example.js'
import { outline } from '../../snippets/icon.js'

const Action = Recipes.Button.style({})

// No results: say what was looked for, and offer the way out.
export default example({
  title: 'No results',
  slots: EmptySlots,
  recipe: Recipes.Empty,
  view: ({ style, h }) =>
    Empty.view(
      {
        icon: outline(h, 'M7 12.5a5.5 5.5 0 100-11 5.5 5.5 0 000 11zM11 11l3.5 3.5'),
        title: 'No results for “invoices 2019”',
        description: 'Check the spelling, or search every folder.',
        action: Button.view({ label: 'Search everywhere', style: Action }, h),
        style,
      },
      h,
    ),
})

In your application: recipe goes to forSlots, and the body of view is the call. example is this site’s harness.

First use #

No projects yet

Projects hold your pages and the people who edit them.

import { Button, Empty, EmptySlots, Recipes } from 'foldkit-mixins-ui'
import { example } from '../../gallery/example.js'
import { outline } from '../../snippets/icon.js'

const Action = Recipes.Button.style({})
const Other = Recipes.Button.style({ variant: 'outline' })

// First use: a dashed frame where the first item will go.
export default example({
  title: 'First use',
  slots: EmptySlots,
  recipe: Recipes.Empty,
  pins: { frame: 'dashed' },
  view: ({ style, h }) =>
    Empty.view(
      {
        icon: outline(h, 'M2.5 4.5h4l1.5 2h5.5v6h-11z'),
        title: 'No projects yet',
        description: 'Projects hold your pages and the people who edit them.',
        action: h.div(
          [h.Style({ display: 'flex', gap: '0.5rem' })],
          [
            Button.view({ label: 'New project', style: Action }, h),
            Button.view({ label: 'Import', style: Other }, h),
          ],
        ),
        style,
      },
      h,
    ),
})

In your application: recipe goes to forSlots, and the body of view is the call. example is this site’s harness.

An error #

Could not load your projects

The server did not answer. Your work is safe.

import { Button, Empty, EmptySlots, Recipes } from 'foldkit-mixins-ui'
import { example } from '../../gallery/example.js'
import { outline } from '../../snippets/icon.js'

const Action = Recipes.Button.style({})

// A load that failed: the icon in the error's ink, and a retry.
export default example({
  title: 'An error',
  slots: EmptySlots,
  recipe: Recipes.Empty,
  pins: { tone: 'danger', frame: 'filled' },
  view: ({ style, h }) =>
    Empty.view(
      {
        icon: outline(h, 'M8 2l6.5 11.5h-13zM8 6.5v3M8 11.5v.01'),
        title: 'Could not load your projects',
        description: 'The server did not answer. Your work is safe.',
        action: Button.view({ label: 'Try again', style: Action }, h),
        style,
      },
      h,
    ),
})

In your application: recipe goes to forSlots, and the body of view is the call. example is this site’s harness.

Usage

Each example above is a module of its own, shown whole and run as shown, over the theme module Create a theme writes. The page hands it the style picked above.

The recipe ↗This code ↗