@ifloom/react/kit
Every export of @ifloom/react/kit, what a plugin's or a game's own React components are built from: its signature and its fields.
Generated from the source of @ifloom/react/kit and its TSDoc by npm run api-docs. Each export links to the page that explains it, where one does.
- Components:
BackButton,Badge,Button,Card,CardContent,CardDescription,CardFooter,CardHeader,CardTitle,Dialog,DialogClose,DialogContent,DialogDescription,DialogHeader,DialogTitle,DialogTrigger,PageHeading,PartDialog,ScrollArea,Separator,Tabs,TabsContent,TabsList,TabsTrigger,Tooltip,TooltipContent,TooltipProvider,TooltipTrigger - Functions:
badgeVariants,buttonVariants,cn,overridable,pluginKit,useDialogParts,useKitPart,usePageParts,usePlugin - Constants:
Icon,KIT_LAYOUT,KIT_LOOKS,KIT_PARTS,PROSE - Types:
BadgeProps,ButtonProps,DialogContentProps,HintCheckContext,IconName,KitPart,Override,PluginControls,PluginKit,PluginPage,PluginPanel,PluginUi,PluginViewOf,UiHint
BackButton
Component. Explained in Plugin UIs and the kit.
Renders a page's Back button, the page-back part, which calls usePage().back().
import { BackButton } from '@ifloom/react/kit'
function BackButton(): JSX.ElementBadge
Component. Explained in Plugin UIs and the kit.
Renders shadcn/ui's badge, a small rounded label in a <span>.
import { Badge } from '@ifloom/react/kit'
function Badge(props: BadgeProps): JSX.ElementUses: BadgeProps.
BadgeProps
Type.
The props of Badge, a <span>'s props and a variant.
import type { BadgeProps } from '@ifloom/react/kit'
type BadgeProps = {
variant?: 'default' | 'secondary' | 'outline' | 'destructive' | null
// …
}Plugins add fields of their own to it, which their pages list.
| Field | Type | Optional | Default | Description |
|---|---|---|---|---|
variant | 'default' | 'secondary' | 'outline' | 'destructive' | null | yes | The badge's look, default, secondary, outline or destructive. default if left out. |
badgeVariants
Function.
Returns the Tailwind classes for a badge's variant, shadcn/ui's badge variants. default if left out.
function badgeVariants(props?: (ConfigVariants<{ variant: { default: string; secondary: string; outline: string; destructive: string; }; }> & ClassProp) | undefined): stringButton
Component. Explained in Plugin UIs and the kit.
Renders shadcn/ui's button, a <button> styled by buttonVariants.
import { Button } from '@ifloom/react/kit'
function Button(props: ButtonProps): JSX.ElementUses: ButtonProps.
ButtonProps
Type.
The props of Button, a <button>'s props with a variant, a size and asChild.
import type { ButtonProps } from '@ifloom/react/kit'
type ButtonProps = {
variant?: 'link' | 'default' | 'secondary' | 'outline' | 'ghost' | 'destructive' | null
size?: 'default' | 'sm' | 'lg' | 'icon' | null
asChild?: boolean
// …
}Plugins add fields of their own to it, which their pages list.
| Field | Type | Optional | Default | Description |
|---|---|---|---|---|
variant | 'link' | 'default' | 'secondary' | 'outline' | 'ghost' | 'destructive' | null | yes | The button's look, default, secondary, outline, ghost, destructive or link. default if left out. | |
size | 'default' | 'sm' | 'lg' | 'icon' | null | yes | The button's size, default, sm, lg or icon (a square for one icon). default if left out. | |
asChild | boolean | yes | True to render the one child element with the button's classes in place of a <button>, through Radix's Slot. False if left out. |
buttonVariants
Function.
Returns the Tailwind classes for a button's variant and size, shadcn/ui's button variants. default for both if left out.
function buttonVariants(props?: (ConfigVariants<{ variant: { default: string; secondary: string; outline: string; ghost: string; destructive: string; link: string; }; size: { default: string; sm: string; lg: string; icon: string; }; }> & ClassProp) | undefined): stringCard
Component. Explained in Plugin UIs and the kit.
Renders shadcn/ui's card, a bordered <div> on the card colour.
import { Card } from '@ifloom/react/kit'
function Card(props: ComponentProps<'div'>): JSX.ElementCardContent
Component.
Renders a card's content, a padded <div>.
import { CardContent } from '@ifloom/react/kit'
function CardContent(props: ComponentProps<'div'>): JSX.ElementCardDescription
Component.
Renders a card's description as a <p> in the muted colour.
import { CardDescription } from '@ifloom/react/kit'
function CardDescription(props: ComponentProps<'p'>): JSX.ElementCardFooter
Component.
Renders a card's footer, a padded <div> that lines its children up in a row.
import { CardFooter } from '@ifloom/react/kit'
function CardFooter(props: ComponentProps<'div'>): JSX.ElementCardHeader
Component.
Renders a card's header, a <div> that stacks its title and description.
import { CardHeader } from '@ifloom/react/kit'
function CardHeader(props: ComponentProps<'div'>): JSX.ElementCardTitle
Component.
Renders a card's title as an <h3>.
import { CardTitle } from '@ifloom/react/kit'
function CardTitle(props: ComponentProps<'h3'>): JSX.Elementcn
Function. Explained in Plugin UIs and the kit.
Returns class names joined into one string, a later Tailwind class winning over an earlier one that conflicts. It's shadcn/ui's cn.
function cn(...inputs: ClassValue[]): stringDialog
Component. Explained in Plugin UIs and the kit.
Renders a dialog's root, Radix's Dialog.Root, which holds whether the dialog is open.
function Dialog(props: DialogProps): ReactNode | Promise<ReactNode>DialogClose
Component.
Renders a control that closes its dialog, Radix's Dialog.Close.
function DialogClose(props: DialogCloseProps & RefAttributes<HTMLButtonElement>): ReactNodeDialogContent
Component.
Renders a dialog's box in a portal, over an overlay, with a close button in its corner.
import { DialogContent } from '@ifloom/react/kit'
function DialogContent(props: DialogContentProps): JSX.ElementUses: DialogContentProps.
DialogContentProps
Type.
The props of DialogContent, Radix's Dialog.Content props with the options below.
type DialogContentProps = {
bare?: boolean
closeLabel?: string
closeIcon?: ReactNode
overlayProps?: (DialogOverlayProps & RefAttributes<HTMLDivElement>) | undefined
closeProps?: (DialogCloseProps & RefAttributes<HTMLButtonElement>) | undefined
// …
}Plugins add fields of their own to it, which their pages list.
| Field | Type | Optional | Default | Description |
|---|---|---|---|---|
bare | boolean | yes | True to leave out the built-in classes on the content, the overlay and the close button, so the caller styles them all. False if left out. | |
closeLabel | string | yes | The close button's text for screen readers. 'Close' if left out. | |
closeIcon | ReactNode | yes | The close button's icon. An X if left out. | |
overlayProps | (DialogOverlayProps & RefAttributes<HTMLDivElement>) | undefined | yes | The props of the overlay behind the dialog, such as a className or a data-part. | |
closeProps | (DialogCloseProps & RefAttributes<HTMLButtonElement>) | undefined | yes | The props of the close button. |
DialogDescription
Component.
Renders a dialog's description in the muted colour, which screen readers read after the title.
function DialogDescription(props: DialogDescriptionProps & RefAttributes<HTMLParagraphElement>): JSX.ElementDialogHeader
Component.
Renders a dialog's header, a <div> that stacks its title and description.
import { DialogHeader } from '@ifloom/react/kit'
function DialogHeader(props: ComponentProps<'div'>): JSX.ElementDialogTitle
Component.
Renders a dialog's title, which screen readers announce. bare leaves out its built-in classes.
function DialogTitle(props: DialogTitleProps & RefAttributes<HTMLHeadingElement> & { bare?: boolean; }): JSX.ElementDialogTrigger
Component.
Renders the control that opens its dialog, Radix's Dialog.Trigger.
function DialogTrigger(props: DialogTriggerProps & RefAttributes<HTMLButtonElement>): ReactNodeHintCheckContext
Type. Explained in Presentation hints.
The context a UiHint's check receives, with the game, the target the hint is on and the game's transition names.
import type { HintCheckContext } from '@ifloom/react/kit'
type HintCheckContext = {
game: Game
on: UiTarget
id?: string
transitions: ReadonlySet<string>
}| Field | Type | Optional | Default | Description |
|---|---|---|---|---|
game | Game | The loaded game, for a hint that names something in it. | ||
on | UiTarget | The sort of target the hint is on, such as a scene, a choice, a block, a stat, an entity or the game. | ||
id | string | yes | The target's id, such as a stat's, a scene's or a choice's id, or a kind's or an entity's reference. | |
transitions | ReadonlySet<string> | The transition names the game has, TRANSITIONS with the game's own ui.transitionNames. |
Icon
Const. Explained in Components.
Renders one of the UI's icons by name, with label as its accessible name. Replace Icon in components to use
your own set everywhere.
import { Icon } from '@ifloom/react/kit'
const Icon: ComponentType<{ name: IconName; label?: string; }>Uses: IconName.
IconName
Type.
The name of an icon the UI renders, named by its use.
import type { IconName } from '@ifloom/react/kit'
type IconName = 'close' | 'back' | 'warning' | 'voice' | 'zoom' | 'menu' | 'chevron'KIT_LAYOUT
Const. Explained in Plugin UIs and the kit.
The layout classes the React UI's built stylesheet always has, for laying out a plugin's parts. A class not listed
here may be missing from styles.min.css.
A UI that needs an unlisted class ships its own stylesheet.
They cover flex and grid, gaps, alignment, growing and shrinking, text sizes and weights, and an entry's buttons
beside its words from Tailwind's sm up. With these, the kit's looks, buttonVariants, badgeVariants, PROSE
and useDialogParts, a plugin's UI needs no stylesheet.
import { KIT_LAYOUT } from '@ifloom/react/kit'
const KIT_LAYOUT: readonly ['flex', 'inline-flex', 'grid', 'contents', 'hidden', 'flex-col', 'flex-row', 'flex-wrap', 'flex-1', 'shrink-0', 'min-w-0', 'w-full', 'items-start', 'items-center', 'items-end', 'justify-between', 'justify-end', 'self-start', 'self-end', 'self-center', 'gap-0.5', 'gap-1', 'gap-1.5', 'gap-2', 'gap-3', 'gap-4', 'text-left', 'text-right', 'text-xs', 'text-sm', 'font-normal', 'font-medium', 'tabular-nums', 'truncate', 'sm:flex-row', 'sm:items-start', 'sm:w-44', 'sm:shrink-0']KIT_LOOKS
Const. Explained in Plugin UIs and the kit.
The Tailwind classes each kit part has with no preset, in the theme's tokens, which useKitPart starts from. A preset
restyles them by data-kit, and a game by classes or its own CSS.
A card is boxed, edged in the primary colour once done and dashed while still open. It's never faded, so its words keep their contrast. A note is small and muted, a meter is a thin bar and an opener is a small outlined button.
import { KIT_LOOKS } from '@ifloom/react/kit'
const KIT_LOOKS: Readonly<Record<KitPart, string>>Uses: KitPart.
KIT_PARTS
Const. Explained in Plugin UIs and the kit.
The kit's parts, the sorts of part any component can mark itself as with data-kit beside its own data-part. A
vendor's goods, a job and an achievement are all cards.
The presets style these and the theme's tokens, never a plugin's own parts. So a plugin's UI looks right in each preset without a stylesheet of its own, and a game's stylesheet can restyle every card at once. The parts are these:
card: a boxed entry in a list, such as a vendor's good, a job or an achievement.item: an entry in a list without a box, such as a status.title: an entry's name.heading: a list's heading.note: a line about an entry, quieter than its title.meter: a progress bar, with a<span>inside as wide as the progress.commands: a group of buttons for a plugin's commands, rather than a scene's choices.opener: a button that opens something over the page, such as a dialog.formandinput: a form and its field for the player to type in, such as a code.badge: a small label on an entry.thumb: a small picture of it.label: a short word beside a value, such as a slot's name.
An entry that can be done sets data-state to "done", or to "open" while it isn't yet. An entry the player
hasn't found yet carries data-secret.
import { KIT_PARTS } from '@ifloom/react/kit'
const KIT_PARTS: readonly ['card', 'item', 'title', 'heading', 'note', 'meter', 'commands', 'opener', 'form', 'input', 'badge', 'thumb', 'label']KitPart
Type. Explained in Plugin UIs and the kit.
The name of a kit part in KIT_PARTS.
import type { KitPart } from '@ifloom/react/kit'
type KitPart = (typeof KIT_PARTS)[number]overridable
Function. Explained in Components.
Returns a component that renders Default, or the game's replacement registered under name in components. Every
component the UI exports is one.
import { overridable } from '@ifloom/react/kit'
function overridable<P extends object>(name: keyof OverridableComponents, Default: ComponentType<P>): ComponentType<P>Uses: OverridableComponents.
Override
Type. Explained in Components.
A component that replaces a built-in one. It gets the same props, and the built-in component as Default.
import type { Override } from '@ifloom/react/kit'
type Override<P> = ComponentType<P & { Default: ComponentType<P> }>PageHeading
Component. Explained in Plugin UIs and the kit.
Renders a page's heading, the page-heading part, as the built-in pages have. A page a plugin or a game adds uses it too.
import { PageHeading } from '@ifloom/react/kit'
function PageHeading(props: { children: ReactNode }): JSX.ElementPartDialog
Component. Explained in Components.
Renders a dialog with the UI's dialog parts, open while open is true and titled title. It calls onClose when
the player closes it.
The menu, PanelHost and the plugins' UIs use it, and a layout of your own can too.
import { PartDialog } from '@ifloom/react/kit'
function PartDialog(props: { open: boolean; onClose: () => void; title: string; children: ReactNode }): JSX.ElementPluginControls
Type. Explained in Plugin UIs and the kit.
The plugin's view, words and send that usePlugin returns to a component.
import type { PluginControls } from '@ifloom/react/kit'
type PluginControls<Id extends string, W extends Words> = {
view: PluginViewOf<Id> | undefined
words: Say<(keyof W & string) | UiStringKey>
send: (command: CommandRef) => Result<GameState>
}| Field | Type | Optional | Default | Description |
|---|---|---|---|---|
view | PluginViewOf<Id> | undefined | The plugin's slice of the view, view.plugins[id], typed. It's undefined in a game without the plugin. | ||
words | Say<(keyof W & string) | UiStringKey> | Returns one of the plugin's words or the UI's by key, the game's ui.<key> string over the English. | ||
send | (command: CommandRef) => Result<GameState> | Sends a command and returns the runner's result, so a caller can show a refusal. The command is one a plugin helper writes, send(shop.buy(vendor, entity)), or a RenderedChoice's command from the view. |
PluginKit
Type. Explained in Plugin UIs and the kit.
A plugin UI's id and words, declared once with pluginKit. Spread it into the PluginUi and pass it to
usePlugin in each component, so every component reads the same words and a typed view.
import type { PluginKit } from '@ifloom/react/kit'
type PluginKit<Id extends string = string, W extends Words = Words> = {
readonly id: Id
readonly words: W
}| Field | Type | Optional | Default | Description |
|---|---|---|---|---|
id | Id | The plugin's id, the same as its engine side's. | ||
words | W | The UI's words in English, by key. A game rewords any of them with ui.<key> in its strings. |
pluginKit
Function. Explained in Plugin UIs and the kit.
Returns the PluginKit for a plugin's id and its words, for usePlugin and the UI's PluginUi. The
words are empty if left out.
const SHOP = pluginKit('shop', SHOP_WORDS) export const shopUi: PluginUi = { ...SHOP, panels: { ... } } // in a component: const { view, words, send } = usePlugin(SHOP)
import { pluginKit } from '@ifloom/react/kit'
function pluginKit<const Id extends string, const W extends Words = Record<never, string>>(id: Id, words?: W): PluginKit<Id, W>PluginPage
Type. Explained in Plugin UIs and the kit.
A page a plugin UI adds among the pages around the game, as a game's PageDef does.
import type { PluginPage } from '@ifloom/react/kit'
type PluginPage = {
label: string
component: ComponentType
showOnTitle?: boolean
}| Field | Type | Optional | Default | Description |
|---|---|---|---|---|
label | string | The label of the page's button on the title screen, as a key of the module's words or the UI's. | ||
component | ComponentType | The component that renders the page. It renders inside the game, so useGame() works in it. | ||
showOnTitle | boolean | yes | True to show a button for the page on the title screen. True if left out. |
PluginPanel
Type. Explained in Plugin UIs and the kit.
A panel a plugin UI renders by name, which content opens with the panel effect.
import type { PluginPanel } from '@ifloom/react/kit'
type PluginPanel = {
component: PanelComponent
title?: string | ((data: Readonly<Record<string, unknown>>, view: View) => string | undefined)
}| Field | Type | Optional | Default | Description |
|---|---|---|---|---|
component | PanelComponent | The component that renders the panel. It gets the panel's with as data. | ||
title | string | ((data: Readonly<Record<string, unknown>>, view: View) => string | undefined) | yes | The panel dialog's title, as a key of the module's words or the UI's, or a function of the panel's with and the view. Content's with.title replaces it. |
PluginUi
Type. Explained in Plugin UIs and the kit.
A plugin's React UI, which its /react subpath exports (shopUi) for a game's plugins list. Every field but id
is optional.
It's a plain object, so a game spreads it and leaves out the parts it doesn't want, such as
{ ...achievementsUi, pages: undefined }.
import type { PluginUi } from '@ifloom/react/kit'
type PluginUi = {
id: string
words?: Words
panels?: Readonly<Record<string, PluginPanel>>
layout?: Readonly<Partial<Record<PluginSpot, readonly ComponentType[]>>>
sections?: Readonly<Record<string, PluginSectionComponent>>
inline?: InlineComponents
hints?: readonly UiHint[]
pages?: Readonly<Record<string, PluginPage>>
settings?: { label: string; component: ComponentType }
components?: Components
provider?: ComponentType<{ children: ReactNode }>
}| Field | Type | Optional | Default | Description |
|---|---|---|---|---|
id | string | The plugin's id, the same as its engine side's. The UI does nothing in a game without that plugin. | ||
words | Words | yes | The UI's words in English, by key. A game rewords any of them with ui.<key> in its strings. | |
panels | Readonly<Record<string, PluginPanel>> | yes | The UI's panels by name, which PanelHost renders when content opens one. A game's own panels of the same name replace them. | |
layout | Readonly<Partial<Record<PluginSpot, readonly ComponentType[]>>> | yes | The components the layout places, by spot. A layout of your own places them with <Plugins at="…" />, or renders them itself. | |
sections | Readonly<Record<string, PluginSectionComponent>> | yes | The components that render a plugin's section in a device's app, by that plugin's id. The game's own sections replace them. | |
inline | InlineComponents | yes | The UI pieces it renders for [[ui:name|…]] in prose, by name. The game's own inline replace them, and checkUiHints checks their names. | |
hints | readonly UiHint[] | yes | The ui hints its components read, each a UiHint, so checkUiHints checks them as it checks the React UI's own. | |
pages | Readonly<Record<string, PluginPage>> | yes | The pages it adds among the pages around the game, by id. A game's own page with the same id replaces one. | |
settings | { label: string; component: ComponentType } | yes | The plugin UI's component for the settings page, such as a box for codes. Without pages it renders behind a menu button labelled by label, a key of the UI's words. | |
components | Components | yes | The built-in components it replaces, by name, as a game's components do. The game's own replace these. | |
provider | ComponentType<{ children: ReactNode }> | yes | A component that wraps the game, for state the UI keeps beside the runner, such as codes being entered. |
PluginViewOf
Type. Explained in Plugin UIs and the kit.
The type of a plugin's slice of the view, view.plugins[id], by the plugin's id. It's the plugin's entry in the
engine's ViewRegistry, or unknown for a plugin that declares none.
import type { PluginViewOf } from '@ifloom/react/kit'
type PluginViewOf<Id extends string> = Id extends keyof ViewRegistry ? ViewRegistry[Id] : unknownUses: ViewRegistry.
PROSE
Const. Explained in Plugin UIs and the kit.
The Tailwind classes for the story's reading column, as wide as --width-prose and placed by --margin-prose. The
column is centred unless Story's align moves it.
Prose, choices, inputs, the scene's title, exits and the people here use it, while pictures and panels take the story's full width.
import { PROSE } from '@ifloom/react/kit'
const PROSE: 'w-full max-w-(--width-prose) mx-(--margin-prose)'ScrollArea
Component. Explained in Plugin UIs and the kit.
Renders shadcn/ui's scroll area, a box that scrolls its children vertically with a thin styled scrollbar.
function ScrollArea(props: ScrollAreaProps & RefAttributes<HTMLDivElement>): JSX.ElementSeparator
Component. Explained in Plugin UIs and the kit.
Renders shadcn/ui's separator, a one-pixel line. It's horizontal and decorative unless the props say otherwise.
function Separator(props: SeparatorProps & RefAttributes<HTMLDivElement>): JSX.ElementTabs
Component. Explained in Plugin UIs and the kit.
Renders a set of tabs, Radix's Tabs.Root, which holds the open tab's value.
function Tabs(props: TabsProps & RefAttributes<HTMLDivElement>): ReactNodeTabsContent
Component.
Renders one tab's content, shown while its trigger is open.
function TabsContent(props: TabsContentProps & RefAttributes<HTMLDivElement>): JSX.ElementTabsList
Component.
Renders the row of tab triggers.
function TabsList(props: TabsListProps & RefAttributes<HTMLDivElement>): JSX.ElementTabsTrigger
Component.
Renders one tab's trigger, which opens the TabsContent with the same value.
function TabsTrigger(props: TabsTriggerProps & RefAttributes<HTMLButtonElement>): JSX.ElementTooltip
Component. Explained in Plugin UIs and the kit.
Renders a tooltip's root, Radix's Tooltip.Root, which holds whether it's open.
function Tooltip(props: TooltipProps): ReactNode | Promise<ReactNode>TooltipContent
Component.
Renders a tooltip's box in a portal, 4 pixels from its trigger unless sideOffset says otherwise.
function TooltipContent(props: TooltipContentProps & RefAttributes<HTMLDivElement>): JSX.ElementTooltipProvider
Component.
Renders the provider that tooltips below it share, Radix's Tooltip.Provider, which sets their delay.
function TooltipProvider(props: TooltipProviderProps): ReactNode | Promise<ReactNode>TooltipTrigger
Component.
Renders the element that opens its tooltip on hover or focus, Radix's Tooltip.Trigger.
function TooltipTrigger(props: TooltipTriggerProps & RefAttributes<HTMLButtonElement>): ReactNodeUiHint
Type. Explained in Presentation hints.
A ui hint a UI reads, declared once with its name, its targets and a check of its value. checkUiHints reports a
hint that no declaration names for its target, and runs each declaration's check.
A plugin UI declares its own in PluginUi.hints.
import type { UiHint } from '@ifloom/react/kit'
type UiHint = {
name: string
on: readonly UiTarget[]
check?: ((value: unknown, cx: HintCheckContext) => string | readonly string[] | undefined)
}| Field | Type | Optional | Default | Description |
|---|---|---|---|---|
name | string | The hint's key under ui. | ||
on | readonly UiTarget[] | The sorts of target content can write the hint on. | ||
check | ((value: unknown, cx: HintCheckContext) => string | readonly string[] | undefined) | yes | Returns the problems with a value, or nothing when it's fine. Word each problem to follow the place it's reported at, such as ui.timer "kettle" is not a timer the game has. |
useDialogParts
Function. Explained in Plugin UIs and the kit.
Returns the attributes for a dialog's dialog, dialog-overlay, dialog-title and dialog-close parts, with
extra classes on the dialog. Every dialog of the UI uses them, so they all look alike.
import { useDialogParts } from '@ifloom/react/kit'
function useDialogParts(extra?: string): { dialog: { 'data-part': PartKey; className: string; }; overlay: { 'data-part': PartKey; className: string; }; title: { 'data-part': PartKey; className: string; }; close: { 'data-part': PartKey; className: string; }; }Uses: PartKey.
useKitPart
Function. Explained in Plugin UIs and the kit.
Returns the data-part, data-kit and className attributes for a part marked as one of the kit's. The game's
unstyled option drops the kit's look and layout, as it drops every built-in class.
The classes are the kit part's look from KIT_LOOKS, then layout, then the game's classes for the part, then
className. useKitPart('card', 'job') is a card, and a list entry with its buttons beside it is
useKitPart('card', 'good', 'sm:flex-row sm:items-start').
import { useKitPart } from '@ifloom/react/kit'
function useKitPart(kit: KitPart, name: PartKey, layout?: string, className?: string): { 'data-part': PartKey; 'data-kit': KitPart; className: string }usePageParts
Function.
Returns the attributes for a page's outer section, centred and as wide as --width-reading, as every built-in page
has. part names the part, title-page by default.
import { usePageParts } from '@ifloom/react/kit'
function usePageParts(className?: string, part?: PartKey): { 'data-part': PartKey; className: string; }Uses: PartKey.
usePlugin
Function. Explained in Plugin UIs and the kit.
Returns a plugin's view, words and send from the running game, for a component of the plugin's UI. It re-renders
whenever the view changes.
The view is typed by the plugin's ViewRegistry entry, and the words are the kit's with the game's ui.<key>
strings over them.
import { usePlugin } from '@ifloom/react/kit'
function usePlugin<Id extends string, W extends Words>(kit: PluginKit<Id, W>): PluginControls<Id, W>Uses: Words, PluginKit, PluginControls.
Last updated on