MDK Logo

Settings components

Pre-built settings UI components for administrative tasks

The @mdk/foundation package provides pre-built settings UI for common administrative tasks.

Either use:

  1. All-in-one dashboard (SettingsDashboard): renders all settings sections in collapsible accordions.
  2. Individual components: use FeatureFlagsSettings, HeaderControlsSettings, etc. directly for custom layouts.

Settings dashboard

The main container that renders settings sections in accordion panels.

Each section renders if you provide its props, giving you control over the sections you need.

import { SettingsDashboard } from '@mdk/foundation'

Props

PropTypeDefaultDescription
showFeatureFlagsbooleanfalseShow the feature flags section (requires featureFlagsProps)
headerControlsPropsHeaderControlsSettingsPropsnoneProps for header controls section
rbacControlPropsRBACControlSettingsPropsnoneProps for RBAC/user management section
importExportPropsImportExportSettingsPropsnoneProps for import/export section
featureFlagsPropsFeatureFlagsSettingsPropsnoneProps for feature flags section
dangerActionsActionButtonProps[]noneArray of danger action buttons from @mdk/core
classNamestringnoneAdditional CSS class

Basic usage

import { SettingsDashboard } from '@mdk/foundation'

function SettingsPage() {
  return (
    <SettingsDashboard
      headerControlsProps={{
        preferences: headerPrefs,
        onToggle: handleToggle,
        onReset: handleReset,
      }}
      rbacControlProps={{
        users,
        roles,
        rolePermissions,
        permissionLabels,
        canWrite: true,
        onCreateUser,
        onUpdateUser,
        onDeleteUser,
      }}
      importExportProps={{
        onExport: handleExport,
        onImport: handleImport,
        onParseFile: parseSettingsFile,
      }}
      dangerActions={[
        {
          label: 'Reboot System',
          variant: 'danger',
          onClick: handleReboot,
        },
      ]}
    />
  )
}

Accordion sections

The dashboard renders each settings section inside an Accordion component from @mdk/core:

Styling

The component uses the .mdk-settings-dashboard CSS class. Key selectors:

  • .mdk-settings-dashboard__title: main heading
  • .mdk-settings-dashboard__danger-actions: container for danger action buttons
  • .mdk-settings-dashboard__accordions: container for accordion sections

Individual components

Use these components directly when you need a custom layout or only one settings section:

ComponentDescription
SettingsDashboardMain settings container with accordion panels
FeatureFlagsSettingsAdd, toggle, and delete feature flags
HeaderControlsSettingsManage header visibility preferences
ImportExportSettingsBackup and restore settings
RBACControlSettingsUser management with RBAC
AddUserModalCreate new users
ManageUserModalModal to edit users
ChangeConfirmationModalConfirmation dialog

On this page