hooks/useEntityButtons#
useEntityButtons()#
Complete entity management buttons
Type Parameters#
| Type Parameter | Default type |
|---|---|
TProtocol |
any |
Parameters#
| Parameter | Type |
|---|---|
config |
UseEntityButtonsConfig<TProtocol> |
Returns#
() => Element
Example#
const EntityButtons = useEntityButtons<CustomPageAPI>({
entityTypeSuffix: 'pages',
methods: {
save: 'save_page',
load: 'load_page',
list: 'list_pages',
preview: 'preview_page'
},
defaultState: {
name: 'Untitled',
layout: '<text label="Welcome!" />',
code: '# Start here'
}
})
return (
<StandardPageAppBar form={<EntityButtons />} />
)
UseEntityButtonsConfig#
useSaveLoad Hook
Provides developer-friendly save/load functionality for plugins. Automatically handles: - Entity browser registration - Save/Load dialogs - Backend communication
Extends#
SaveLoadConfig<TProtocol>
Type Parameters#
| Type Parameter | Default type |
|---|---|
TProtocol |
any |
Properties#
currentEntityName?#
Current entity name (for highlighting in entity browser)
Inherited from#
SaveLoadConfig.currentEntityName
defaultState?#
Default state for "New" button
dialogTitles?#
Custom dialog titles
load?#
saveAs?#
entityTypeSuffix?#
Custom entity type suffix (default: 'entities')
Inherited from#
SaveLoadConfig.entityTypeSuffix
labels?#
Custom button labels
load?#
new?#
save?#
saveAs?#
methods?#
optional methods?: {
list?: keyof TProtocol;
load?: keyof TProtocol;
preview?: keyof TProtocol;
save?: keyof TProtocol;
};
Backend method names - type-safe against protocol interface
list?#
load?#
preview?#
save?#
Inherited from#
newMethod?#
Method to call for "New" (optional - can handle client-side)
previewComponent?#
Optional custom preview component