type

RowLabelDefinition

The heading component and optional settings decoder passed to defineRowLabel.

Example

ts
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 })
  }
});

Row label options

PropertyTypeDescription
componentComponent<RowLabelProps<Config>>Required. A Svelte heading component. row contains current unsaved values; rowNumber starts at one and updates when the row moves.
decodeConfig(value: unknown) => ConfigOptional. 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.

How it works

TypeScript infers Config from decodeConfig. Without settings, the component does not receive a config prop.

Full signature

type RowLabelDefinition<Config = undefined> = { component: Component<RowLabelProps<NoInfer<Config>>>; } & (0 extends 1 & Config ? { decodeConfig: (value: unknown) => Config } : [Config] extends [never] ? { decodeConfig: (value: unknown) => Config } : [Config] extends [undefined] ? { decodeConfig?: (value: unknown) => Config } : { decodeConfig: (value: unknown) => Config })

Source packages/plugin/src/admin.ts:171

Related guides