Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

PalmDevs/m3-solid

Repository files navigation

M3 Solid

Material Design 3 components for SolidJS.

Installation

TODO.

Usage

Card Title

Card content goes here

} >

Dialog content

); }">import { Button, Card, Switch, Dialog } from 'm3-solid';
import { createSignal } from 'solid-js';
import 'm3-solid/styles.css';
import 'm3-solid/themes/default.css';
// or bring your own theme

function App() {
const [checked, setChecked] = createSignal(false);
const [open, setOpen] = createSignal(false);

return (
<div>
<Button variant="filled" onClick={() => setOpen(true)}>
Open Dialog
Button>

<Card variant="elevated">
<h3>Card Titleh3>
<p>Card content goes herep>
Card>

<label>
<Switch
checked={checked()}
onChange={setChecked}
icons="both"
/>
<span>Togglespan>
label>

<Dialog
headline="Dialog Title"
open={open()}
onOpenChange={setOpen}
actions={
<>
<Button variant="text" onClick={() => setOpen(false)}>CancelButton>
<Button variant="filled" onClick={() => setOpen(false)}>OKButton>
>
}
>
<p>Dialog contentp>
Dialog>
div>
);
}

Design Tokens

The library includes all Material Design 3 design tokens:

  • Elevation levels (0-5)
  • Shape tokens (extra-small, small, medium, large, extra-large, full)
  • Typography scale (display, headline, title, label, body)
  • Easing functions (emphasized, standard, fast, slow, spatial)

Color Theming

You can define your color scheme using CSS custom properties. See themes/default.css for an example.

:root {
--m3c-primary: #6750A4;
--m3c-on-primary: #FFFFFF;
--m3c-secondary: #625B71;
--m3c-on-secondary: #FFFFFF;
--m3c-surface: #FEF7FF;
--m3c-on-surface: #1C1B1F;
/* ... and more */
}

Development

# Install dependencies
bun install

# Run demo
bun dev

# Build library
bun run build

License

Apache-2.0 OR GPL-3.0-only

Attribution

Ported from m3-svelte by KTibow.

Assistance from LLMs were used in this project.

About

Implements the Material 3 design system in SolidJS.

Resources

Readme

License

View license

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors