Thinking indicator
An assistant at work, announced politely: dots, a pulse or an icon beside words a band of light sweeps.
Previews are drawn in the theme you made.
Edit itBasic #
ThinkingSearching the web
import { Recipes, ThinkingIndicator, ThinkingIndicatorSlots } from 'foldkit-mixins-ui'
import { example } from '../../gallery/example.js'
// A polite status: three dots and shimmering words, and what it is doing.
export default example({
title: 'Basic',
slots: ThinkingIndicatorSlots,
recipe: Recipes.ThinkingIndicator,
view: ({ style, h }) => ThinkingIndicator.view({ detail: 'Searching the web', style }, h),
})In your application: recipe goes to forSlots, and the body of view is the call. example is this site’s harness.
Kinds #
Thinking
Thinking
Thinking
Thinking
import { Recipes, ThinkingIndicator, ThinkingIndicatorSlots } from 'foldkit-mixins-ui'
import { example } from '../../gallery/example.js'
const kinds = [
{ mark: 'dots', label: 'shimmer' },
{ mark: 'pulse', label: 'plain' },
{ mark: 'none', label: 'shimmer' },
{ mark: 'dots', label: 'hidden' },
] as const
const styles = kinds.map(selection => Recipes.ThinkingIndicator.style(selection))
// Dots or a pulse beside the words, the words alone, or the dots alone with
// the words said, not shown. Each holds still under reduced motion.
export default example({
title: 'Kinds',
slots: ThinkingIndicatorSlots,
recipe: Recipes.ThinkingIndicator,
view: ({ h }) =>
h.div(
[h.Style({ display: 'grid', gap: '1rem', justifyItems: 'start' })],
styles.map(style => ThinkingIndicator.view({ label: 'Thinking', style }, h)),
),
})In your application: recipe goes to forSlots, and the body of view is the call. example is this site’s harness.
Accent #
ThinkingSearching the web
import { Recipes, ThinkingIndicator, ThinkingIndicatorSlots } from 'foldkit-mixins-ui'
import { example } from '../../gallery/example.js'
// In the accent's ink: the recipe's `tone` axis, held here.
export default example({
title: 'Accent',
slots: ThinkingIndicatorSlots,
recipe: Recipes.ThinkingIndicator,
pins: { tone: 'accent' },
view: ({ style, h }) => ThinkingIndicator.view({ detail: 'Searching the web', style }, h),
})In your application: recipe goes to forSlots, and the body of view is the call. example is this site’s harness.
Configure once #
SuchtIm Web
import { Recipes, ThinkingIndicator, ThinkingIndicatorSlots } from 'foldkit-mixins-ui'
import { example } from '../../gallery/example.js'
const Calm = Recipes.ThinkingIndicator.style({ mark: 'pulse', label: 'plain', tone: 'accent' })
// The application's look and its word for the wait, said once; a use names a
// preset or gives its own `label`.
const AppThinking = ThinkingIndicator.configure({
base: { style: Calm, label: 'Denkt nach' },
presets: { search: { label: 'Sucht' } },
})
export default example({
title: 'Configure once',
slots: ThinkingIndicatorSlots,
recipe: Recipes.ThinkingIndicator,
view: ({ h }) => AppThinking.view({ preset: 'search', detail: 'Im Web' }, 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.