function
defineRowLabel
Show a custom summary in the heading of an array or block row, including its current unsaved values.
Example
import { defineAdmin, defineRowLabel } from '@riducms/plugin/admin';
import { generatedAdminPlugins } from './ridu.plugins.generated';
import LinkRowLabel from './components/link-row-label.svelte';
export default defineAdmin({
plugins: generatedAdminPlugins,
rowLabels: {
'app:linkSummary': defineRowLabel({ component: LinkRowLabel })
}
});Arguments
| Argument | Description |
|---|---|
definition | Required object with the Svelte heading component and an optional settings decoder. |
Row label options
| Property | Type | Description |
|---|---|---|
component | Component< | Required. A Svelte heading component. row contains current unsaved values; rowNumber starts at one and updates when the row moves. |
decodeConfig | (value: unknown) => Config | Optional. Check settings supplied through Go field.Component. Return the typed config prop synchronously, or throw. A decoder requires a Go settings object; without one, omit Go settings. |
Returns
A frozen RegisteredRowLabel for defineAdmin’s rowLabels map. Register it under app:name and choose that name in Go Admin.RowLabel.
RegisteredRowLabelHow it works
Start with RowLabelPath in Go when the value of one child field is enough. Use a component when the heading needs to combine values or show richer content.
Register under an app:name key, then select field.Component("app:name") in the array or block field’s Admin.RowLabel. Keep RowLabelPath for the plain-text name used by row actions and screen readers.
The component receives RowLabelProps, including row, rowNumber, and the containing field. Row values include unsaved edits. A row label displays information; editing controls belong in field components.
Custom labels also work on arrays and blocks inside rich-text block forms. The linked guide supplies the complete LinkRowLabel component and Go collection used in this example.
Full signature
function defineRowLabel<Config = undefined>(
definition: RowLabelDefinition<Config>,
): RegisteredRowLabelRelated types
RowLabelDefinitionThe heading component and optional settings decoder passed to
defineRowLabel.RegisteredRowLabelHelper result stored in
defineAdmin({ rowLabels: ... }); do not construct it manually.RowLabelPropsThe current row values and position passed to a custom array or block heading.