A library of Svelte 3 Material UI components, based on the Material Design Components - Web.
Here are some features you should know about:
- You can add arbitrary attributes to all of the components and many of the elements within them.
- You can add actions to the components with
use={[Action1, [Action2, action2Props], Action3]}
. - You can add props to lower components and elements with "$" props, like
input$maxlength="15"
. - All events are forwarded. This includes DOM events, MDC events, and custom events.
- You can add event modifiers with the
on:click$preventDefault$capture={handler}
syntax.- If you use Svelte's native
on:click|preventDefault={handler}
syntax, it will not compile. You have to use "$" instead of "|". (The extra S inside the | stands for SMUI.)
- If you use Svelte's native
- Supported modifiers are:
- preventDefault
- stopPropagation
- passive
- nonpassive
- capture
- once
- You can add event modifiers with the
- Labels and icons are named exports in the components that use them, or you can use the 'Label' and 'Icon' exports from '@smui/common'. (Except for chips labels and icons, textfield icons, and select icons, because they are special snowflakes.)
- SMUI supports RTL languages.
To get started, check out the installation docs.
Upgrading from an old version? Be sure to read the migration doc.
Upgrading from v2? There are lots of changes listed in the upgrade instructions.
Upgrading from v3? SMUI's styling method has been simplified. Check out the upgrade instructions.
If you need help using SMUI, join the new Discord server.
Click a component/package below to go to the documentation. (Note that this documentation is a work in progress. The demo code should be your main source of truth for how something works.)
- Banner
- Button
- Card
- Common
- Data Table
- Dialog
- Drawer
- Elevation†
- Image List
- Inputs and Controls
- Layout Grid
- List
- Menu Surface
- Menu
- Paper‡
- Progress Indicators
- Ripple
- Snackbar
- Tabs
- Tooltip
- Top App Bar
- Touch Target
- Typography†
† This is Sass based, and therefore doesn't require Svelte components. I've included a demo showing how you can use it.
‡ This is not an MDC Web component. It is an addition that SMUI provides.
You can support my work on this project through my other project, Tunnelgram. I have a Patreon set up for it. I started this project in order to Materialize Tunnelgram.
Copyright 2020-2021 Hunter Perrin
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.