Skip to main content

SchemaButtons

Renders the action buttons a record's schema declares, overflowing into a menu when there are too many.

The generated views mount it for you — in the view toolbar, in the row action column, in the form toolbar. Use it directly when you build a screen of your own that should offer the same actions.

Example​

<SchemaButtons record={order} isList={false} maxVisibleButtons={4} />

Props​

On top of these it accepts ActionButtonProps — except variant and showLabel, which it redefines below so they can be set per action.

NameTypeDefaultDescription
recordHabRecordrecord from contextRecord whose actions are rendered; also provides the record context to the buttons
descriptorsActionDescriptor[]all actions in the schemaRestricts and reorders the actions, and can override their label, icon or colour
isListbooleanfalseRenders the compact variant used in datagrid rows
onlyDetailbooleanfalseKeeps only the actions meant for a detail view
targetstring—Marks the current screen as the origin, so the action can return to it
variantButtonVariant | ((name: string) => ButtonVariant)—MUI variant, optionally per action
showLabelboolean | ((name: string) => boolean)trueWhether to show labels, optionally per action
viewNamestringview from contextView whose action set is used
iconOnlyboolean | BreakpointfalseRenders every button icon-only; a breakpoint collapses the labels only below that width. Overflow menu items always keep theirs
maxVisibleButtonsResponsiveCount6Buttons shown before the rest move into the ⋮ menu. A number, or a per-breakpoint map ({xs: 1, lg: 2}). The ⋮ trigger itself is never counted
minVisibleButtonsnumber1Fewest buttons kept inline when maxVisibleButtons overflows. Pass 0 to allow every button to collapse into the ⋮ menu

Where the actions come from​

Actions live in the record's meta.schema.actions, which the backend fills per record. A user without permission for an action simply does not receive it, so nothing has to be hidden on the frontend.

tip

A descriptor may nest menuItems, which groups several actions under one button. A group whose items are all missing from the schema is dropped rather than rendered empty.

See also​