MDK Logo

Get started

Set up MDK UI Kit and render your first component

This guide walks you through setting up the MDK UI Kit and rendering your first component.

Prerequisites

  • Node.js 20+ (LTS)
  • pnpm 10+ (package manager)
  • React 18+

To enable pnpm using corepack (built into Node.js):

corepack enable
pnpm --version

1. Clone and build

MDK UI Kit is currently distributed as a monorepo. Your app will live inside the monorepo workspace alongside the packages.

Clone the repository and build all packages:

# Clone the repository
git clone https://github.com/tetherto/miningos-ui-kit.git
cd miningos-ui-kit

# Install dependencies
pnpm install

# Build all packages
pnpm build

This builds @mdk/core, @mdk/foundation, and @mdk/fonts.

2. Create your app

Create a new React app in the apps/ folder:

cd apps
pnpm create vite my-app --template react-ts
cd my-app

Update your app's package.json to use the workspace packages:

{
  "name": "my-app",
  "private": true,
  "dependencies": {
    "@mdk/core": "workspace:*",
    "@mdk/foundation": "workspace:*",
    "react": "catalog:",
    "react-dom": "catalog:"
  }
}

Then install from the monorepo root:

cd ../..
pnpm install

3. Import styles

In your app's entry point (e.g., main.tsx), import the MDK styles:

import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './App'

// Import MDK styles
import '@mdk/core/styles.css'

ReactDOM.createRoot(document.getElementById('root')!).render(
  <React.StrictMode>
    <App />
  </React.StrictMode>
)

4. Render your first component

Replace your App.tsx with a simple example using MDK components:

import { Button, Card } from '@mdk/core'

function App() {
  return (
    <div style={{ padding: '2rem' }}>
      <Card>
        <h1>Hello MDK</h1>
        <p>Your first MDK UI Kit component is working!</p>
        <Button onClick={() => alert('Clicked!')}>
          Click me
        </Button>
      </Card>
    </div>
  )
}

export default App

Run your app:

pnpm --filter my-app dev

You should see a card with a button. Clicking the button shows an alert.

Next steps

Now that you have MDK working, explore the packages:

  • @mdk/core: Base UI components (buttons, inputs, tables, dialogs, charts)
  • @mdk/foundation: Domain-specific components for mining applications (settings, hooks, constants)

Run the demo app

The monorepo includes a comprehensive demo showcasing all components:

pnpm dev:demo

Open http://localhost:5173 to browse examples.

Use domain components

For mining-specific features, use @mdk/foundation:

import { FeatureFlagsSettings } from '@mdk/foundation'

function SettingsPage() {
  return (
    <FeatureFlagsSettings
      isEditingEnabled={true}
      featureFlags={{ darkMode: true, betaFeatures: false }}
      onSave={(flags) => console.log('Saved:', flags)}
    />
  )
}

See the Settings components documentation for more examples.

On this page