![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
mithril-mdl-extended
Advanced tools
This module provides mithril components which construct HTML to be used with the Material Design Lite framework.
It provides a simple way to apply the needed classes to create MDL components. It spits out normal HTML elements, and calls componentHandler.upgradeElement(element)
on element creation. It is designed to work nicely with JSX (via babel or similar).
Not nearly all components are supported right now. I will continue adding them when the need comes up. Your are welcome to submit pull requests :)
Some attributes will be used by all components and are carried over (id
, class
, config
, href
, disabled
, value
, for
). This includes all on-
event handlers.
And these attributes all apply some classes:
large
: applies mdl-layout--large-screen-only
ripple
: applies mdl-js-ripple-effect
active
: applies is-active
primary
: applies mdl-color--primary
primaryDark
: applies mdl-color--primary-dark
shadow
: applies mdl-shadow--${shadow}dp
color
: applies mdl-color--${color}
textColor
: applies mdl-color-text--${textColor}
Components can be imported from the module directly:
ES6:
import {Button} from 'mithril-mdl';
ES5:
var Button = require('mithril-mdl').Button;
You may then use them like so: JSX:
m.render(document.body, <Button ripple accent raised>I am a button!</Button>);
ES5/ES6:
m.render(document.body, m(Button, {ripple: true, accent: true, raised: true}, 'I am a button!'));
Documentation for all components can be found in the docs/components directory.
Mixins are often provided as lowercase versions of the corresponding components. They are annotated in the components documentation. More information can be found here.
Example:
import {Cell, grid} from 'mithril-mdl';
/**
* Creates a cell with a grid mixin.
* Cell will be passed attr, grid will use grid--attr instead.
* Cell and grid will both use attr2
*/
export default <Grid>
<Cell mixin={grid} attr="value1" grid--attr="value2" attr2="value3">
<Cell>Some Stuff</Cell>
</Cell>
</Grid>
FAQs
Material Design Lite components via mithril.js
We found that mithril-mdl-extended demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.