monobill-mintui
v0.6.695
Published
Framework-independent HTML custom elements with component-scoped CSS.
Maintainers
Readme
MintUI
MintUI is a considered collection of native HTML custom elements. Import the components you need and use them in plain HTML, Vue, React, Angular, or another framework that supports custom elements.
Component styles use Tailwind CSS utilities while developing. npm run build compiles the styles for all 38 components into separate CSS files and creates an aggregate stylesheet. Importing a component's JavaScript entry registers its JavaScript dependencies and automatically loads the separate CSS files for that component and its dependencies. Consuming projects do not need Tailwind or a framework.
Install
npm install monobill-mintuiInstall components with the CLI
The mint-ui command installs one component at a time, detects the current project, and wires the component into its entry point. In an interactive terminal, use the arrow keys to confirm or change the detected setup. Choose Other (manual import) when you want to manage imports yourself.
The CLI supports Vue, Angular, React, Svelte, and plain HTML projects. It detects the project type and lets you confirm or change the detected setup with the arrow keys. It then configures the project so you can use the element directly. For plain HTML it adds the required styles and module script to index.html.
npx mint-ui install button
npx mint-ui update
npx mint-ui listnpx mint-ui install buttoninstalls and configures only the Button component. Repeat with another component name to add it to the project.npx mint-ui updateupdates MintUI and reconfigures the components recorded inmintui.json.npx mint-ui listprints the available component names.
If MintUI is already installed in the project, run mint-ui install button and mint-ui update directly (or use the equivalent package-manager exec command).
After installation, use the custom element directly:
<mint-button>Test</mint-button>The CLI uses the project's npm, pnpm, Yarn, or Bun lockfile to choose its package manager.
Plain HTML
<script type="module">
import './node_modules/monobill-mintui/dist/components/button/browser.js'
</script>
<mint-button variant="solid" tone="action">Get started</mint-button>Import individual components for smaller application bundles:
import 'monobill-mintui/button'
import 'monobill-mintui/switch'Package subpath imports such as import 'monobill-mintui/button' automatically import the component's compiled CSS and dependencies in bundlers. For native browser modules, use the browser.js entry shown above; it loads the same separate CSS files at runtime. monobill-mintui/styles.css remains available when an application prefers importing the entire compiled stylesheet once.
Frameworks
Register the custom elements once in the application's entry point, then use their HTML tags in your templates. Events are standard DOM events. Boolean controls expose properties such as checked and also emit change events.
import 'monobill-mintui/button'
import 'monobill-mintui/checkbox'<mint-checkbox label="Send me product updates"></mint-checkbox>Components
| Component | Custom element | Documentation |
|---|---|---|
| Button | <mint-button> | Button |
| Switch | <mint-switch> | Switch |
| Checkbox | <mint-checkbox> | Checkbox |
| Choice | <mint-choice> | Choice |
| Spinner | <mint-spinner> | Spinner |
| Icon | <mint-icon> | Icon |
| Text | <mint-text> | Text |
| Stack | <mint-stack> | Stack |
| Card | <mint-card> | Card |
| Link | <mint-link> | Link |
| Page | <mint-page> | Page |
| Grid | <mint-grid> | Grid |
| Modal | <mint-modal> | Modal |
| Popover | <mint-popover> | Popover |
| Back Button | <mint-back-button> | Back Button |
Styling
Component styles are split into separate files. Import only the CSS modules for the components your app uses; Vite and other CSS-aware bundlers combine them into one application CSS file. For example, use monobill-mintui/button.css with monobill-mintui/button. Theme the default palette with CSS custom properties:
@import "monobill-mintui/theme.css";
:root {
--mint-color-primary: #315943;
--mint-color-surface: #ffffff;
--mint-color-text: #28372d;
--mint-color-border: #dfe6e0;
}The theme.css file provides the light palette by default and switches to its dark palette when the root element has data-mint-theme="dark" (or the legacy dark class). Update a token at any time with CSS or JavaScript; components respond immediately:
document.documentElement.style.setProperty('--mint-color-primary', '#6a4c93')
document.documentElement.dataset.mintTheme = 'dark'Available tokens include --mint-color-primary, --mint-color-info, --mint-color-warning, --mint-color-danger, --mint-color-success, --mint-color-text, --mint-color-text-secondary, --mint-color-text-muted, --mint-color-surface, --mint-color-surface-raised, --mint-color-surface-muted, --mint-color-border, and --mint-color-focus. Component styles include light-mode fallbacks, so theme.css is only needed when you want the shared palette, runtime theming, or dark mode.
Develop
npm install
npm run dev
npm run buildComponent source styles use Tailwind during development. The build compiles and packages all component and aggregate CSS; the documentation site imports that built output, and consuming projects do not need Tailwind.
