MDK Logo

Action

Buttons, action triggers, and export controls

Components for triggering actions and user interactions.

Prerequisites

  • Complete the installation

  • Add the dependency to your app's package.json
{
  "dependencies": {
    "@tetherto/mdk-react-devkit": "*",
    "@tetherto/mdk-react-adapter": "*",
    "@tetherto/mdk-ui-foundation": "*"
  }
}

Run npm install from the mdk/ui workspace root after your app is under apps/ so npm links workspace packages.

  • Import styles: import '@tetherto/mdk-react-devkit/styles.css'

Components

@tetherto/mdk-react-devkit

Button

import { Button } from '@tetherto/mdk-react-devkit'

Primary action button with variants, sizes, loading state, icon placement, and full-width layout. Forwards refs and all native <button> attributes.

Data contracts

ButtonVariant and ComponentSize are exported from core/types.

Notes

  • aria-busy is set when loading is true
  • When loading is true the inner spinner is the only child; icon and children are hidden.

Example

/**
 * Runnable example for Button.
 */
import { Button } from '@tetherto/mdk-react-devkit'

export const ButtonExample = () => (
  <div className="mdk-example-row">
    <Button variant="primary">Primary</Button>
    <Button variant="secondary">Secondary</Button>
    <Button variant="primary" loading>
      Submitting
    </Button>
    <Button variant="secondary" disabled>
      Disabled
    </Button>
    <Button variant="primary" size="sm">
      Small
    </Button>
    <Button variant="primary" size="lg">
      Large
    </Button>
  </div>
)
@tetherto/mdk-react-devkit

Import the public APIs on this page from @tetherto/mdk-react-devkit.

ActionButton

ActionButton component with confirmation popover or dialog

agent-ready

Source

https://github.com/tetherto/mdk/blob/main/ui/packages/react-devkit/src/primitives/components/action-button/USAGE.md#props-detail

Props

PropStatusType / OptionsDefaultDescription
confirmationRequiredActionButtonConfirmation-Configuration for the confirmation UI
classNameOptionalstring-Additional class for the trigger button
disabledOptionalboolean-Disables the trigger button
labelOptionalstring-Button label text
loadingOptionalboolean-Shows a spinner on the trigger button
modeOptional"dialog" | "popover""popover"Confirmation mode: popover (inline) or dialog (modal)
variantOptional"primary" | "danger" | "secondary""secondary"Visual style of the trigger button

Button

Primary action button. Supports loading state with spinner, icon placement, variants, sizes, and full-width layout. Forwards refs and all native button attributes

agent-ready

Source

https://github.com/tetherto/mdk/blob/main/ui/packages/react-devkit/src/primitives/components/button/index.tsx

Props

PropStatusType / OptionsDefaultDescription
contentClassNameOptionalstring-Class names applied to the inner content wrapper
disabledOptionalbooleanfalseDisable the button
fullWidthOptionalbooleanfalseMake the button stretch to fill its container
iconOptionalReact.ReactNode-Icon node rendered alongside children
iconPositionOptional"left" | "right""left"Icon placement relative to children
loadingOptionalbooleanfalseShow a spinner instead of the content and disable the button
sizeOptional"sm" | "md" | "lg"-Size token (sm, md, lg)
typeOptional"button" | "submit" | "reset""button"Native button type
variantOptional"icon" | "link" | "primary" | "danger" | "secondary" | "tertiary" | "nav-link" | "outline" | "ghost""secondary"Visual variant (e.g. primary, secondary, ghost)

StatsExport

Dropdown button that triggers asynchronous CSV or JSON export. Shows a spinner while the corresponding handler is awaited

agent-ready

Source

https://github.com/tetherto/mdk/blob/main/ui/packages/react-devkit/src/domain/components/stats-export/index.tsx

Props

PropStatusType / OptionsDefaultDescription
onCsvExportRequired() => Promise<void>-Awaited; spinner shown while pending
onJsonExportRequired() => Promise<void>-Awaited; spinner shown while pending
disabledOptionalbooleanfalseDisable the trigger
hideLabelOptionalbooleanfalseHides the textual "Export" label

On this page