项目作者: matyunya

项目描述 :
UI framework with material components built with Svelte and Tailwind CSS
高级语言: Svelte
项目地址: git://github.com/matyunya/smelte.git
创建时间: 2019-06-27T07:11:19Z
项目社区:https://github.com/matyunya/smelte

开源协议:MIT License

下载


Smelte

Smelte logo

license
downloads
version
Discord Chat

Demo

Smelte is a UI framework built on top of Svelte and Tailwind CSS using Material Design spec (hence the name).
It comes with many components and utility functions making it easy to build beautiful responsive layouts while keeping
bundle size and performance at check all thanks to Svelte.

Installation

To get you started you need to add Smelte to your dependencies with your favorite package manager

  1. $ npm install smelte

or

  1. $ yarn add smelte

Then add the Smelte Rollup plugin (after svelte but before css). Webpack support coming soon.

  1. const smelte = require("smelte/rollup-plugin-smelte");
  2. plugins = [
  3. ...your plugins,
  4. smelte({
  5. purge: production,
  6. output: "public/global.css", // it defaults to static/global.css which is probably what you expect in Sapper
  7. postcss: [], // Your PostCSS plugins
  8. whitelist: [], // Array of classnames whitelisted from purging
  9. whitelistPatterns: [], // Same as above, but list of regexes
  10. tailwind: {
  11. theme: {
  12. extend: {
  13. spacing: {
  14. 72: "18rem",
  15. 84: "21rem",
  16. 96: "24rem"
  17. }
  18. }
  19. }, // Extend Tailwind theme
  20. colors: {
  21. primary: "#b027b0",
  22. secondary: "#009688",
  23. error: "#f44336",
  24. success: "#4caf50",
  25. alert: "#ff9800",
  26. blue: "#2196f3",
  27. dark: "#212121"
  28. }, // Object of colors to generate a palette from, and then all the utility classes
  29. darkMode: true,
  30. }, // Any other props will be applied on top of default Smelte tailwind.config.js
  31. }),
  32. ]

Then you should add Tailwind utilites CSS in your app component.

  1. import "smelte/src/tailwind.css";

You might also need to include material icons in your template’s if you use any:

  1. <link
  2. href="https://fonts.googleapis.com/icon?family=Material+Icons"
  3. rel="stylesheet"
  4. />

Or ship them along with Roboto if you would like to use default material font

  1. <link
  2. href="https://fonts.googleapis.com/css?family=Roboto:300,400,500|Material+Icons&display=swap"
  3. rel="stylesheet"
  4. />

And you’re good to go and have all the Tailwind CSS power all to yourself!

For treeshaking to work it is recommended to import each component on its own like this:

  1. import Button from "smelte/src/components/Button";
  2. import Treeview from "smelte/src/components/Treeview";

Components

  • Text field
  • Button
  • Select
  • Checkbox
  • Radio
  • List
  • Chip
  • Menu
  • Navigation drawer
  • Snackbar
  • Dialog
  • Card
  • Slider
  • Proper customization via class props
  • Data table
  • Autocomplete
  • Tooltip
  • Revise events (on:change, on:focus, on:input…)
  • Treeview
  • Date picker

Features

  • Default typography per Material design spec
  • Material icons
  • CSS ripple animation
  • Image lazy loading
  • Now SSR deployment
  • Color palette generator
  • Improve Purge CSS
  • Theming
  • Image processing (done here)
  • Svelte template (without Sapper)
  • JS ripple animation
  • Dark mode