0.4.0 • Published 3 months ago

@hypericon/mico v0.4.0

Weekly downloads
-
License
MIT
Repository
-
Last release
3 months ago

Mico

Mithril Components

UI components and utilities built with Mithril.

NPM badge

Since version 0.4.0, includes ESM and CJS versions.

Installation

$ npm i @hypericon/mico

Usage

View usage documentation and examples here.

Example

Import the components from the package. Some components may also export functions to build typed versions. Components that have customisable styles have their CSS classes of config attributes documented on the documentation site

import m from "mithril";
import { typedTable } from "@hypericon/mico";
import { Widget } from "../interfaces"; // Example
import { WidgetService } from "../services"; // Example
import { WidgetStatusIcon } from "../components"; // Example

const WidgetTable = typedTable<Widget>();

const ExamplePage: m.Component = {
  view() {
    return m("", [
      m("h1", "Widgets"),
      m(WidgetTable, {
        data: WidgetService.widgets,
        columns: [
          WidgetTable.col("Position", (w, i) => i + 1), // Row index is supplied
          WidgetTable.col("Name", w => w.name), // Type checking on row object properties
          WidgetTable.col("Price", w => `£${w.price}`),
          WidgetTable.col("Status", w => m(WidgetStatusIcon, { widget: w })),
          // etc.
        ],
      }),
    ]);
  }
};

Development

Start a hot-reloading dev server serving the documentation and example site with

$ npm run dev

Publish the updated package and deploy the latest version of the docs site with

$ npm run publish-deploy

License

MIT

0.4.0

3 months ago

0.3.20

10 months ago

0.3.24

10 months ago

0.3.23

10 months ago

0.3.21

10 months ago

0.3.17

10 months ago

0.3.16

10 months ago

0.3.15

10 months ago

0.3.14

10 months ago

0.3.19

10 months ago

0.3.18

10 months ago

0.3.13

10 months ago

0.3.12

10 months ago

0.3.11

11 months ago

0.3.10

11 months ago

0.3.9

11 months ago

0.3.8

11 months ago

0.3.7

11 months ago

0.3.6

11 months ago

0.3.5

11 months ago

0.3.4

11 months ago

0.3.3

11 months ago

0.3.2

11 months ago

0.3.1

11 months ago

0.3.0

11 months ago

0.2.7

11 months ago

0.2.6

11 months ago

0.2.5

11 months ago

0.2.4

11 months ago

0.2.3

11 months ago

0.2.2

11 months ago

0.2.1

11 months ago

0.2.0

12 months ago

0.1.0

12 months ago