svelte-mui

Simple Svelte 3 UI components

Github星跟蹤圖

svelte-mui

Set of the UI components for Svelte (~30 KB minzipped), inspired by Google's Material Design

View the demo

Installation

Note that you will need to have Node.js installed

npm install --save-dev svelte-mui

Usage

<Textfield bind:value filled label="Name" message="Enter your name" />

<h1>Hello {value}!</h1>

<script>
    // import any components you want
    import { Textfield } from 'svelte-mui';

    let value = 'world';
</script>

This code on the Svelte REPL

Quick start with new project

Create a new project based on sveltejs/template

npx degit sveltejs/template svelte-app
cd svelte-app
npm install

Add components

npm install --save-dev svelte-mui
  • Optionally add focus-visible polyfill to enable focus to be visible when using TAB key. This option can be applied to Button, Checkbox, Radio button, Menuitem
npm install --save-dev focus-visible

Modify file src/App.svelte in the following way

<script>
    // optional import focus-visible polyfill only once
    import 'focus-visible';
    // import any components
    import { Button, Checkbox } from 'svelte-mui';

    let checked = true;
</script>

<Checkbox bind:checked>Checkbox</Checkbox>

<p>Checkbox is {checked ? 'checked' : 'unchecked'}</p>

<Button
    outlined
    shaped
    color="Red"
    on:click={() => { checked = !checked }}
>
    Inverse
</Button>

Note for the sapper application, you must import components from svelte-mui/src like so

    import { Button, Checkbox } from 'svelte-mui/src';

...then start Rollup

npm run dev

Navigate to localhost:5000

For real applications, you have to add global styles to disabled state

    .disabled,
    [disabled] {
        opacity: 0.5;
        pointer-events: none;
    }

    .disabled .disabled,
    .disabled [disabled],
    [disabled] .disabled,
    [disabled] [disabled] {
        opacity: 1;
    }

Get started with an example

Clone repo vikignt/svelte-mui

git clone https://github.com/vikignt/svelte-mui.git

Then explore the example

cd svelte-mui/example
npm install
npm run dev

Navigate to localhost:5000

Get started with an sapper example

Clone repo vikignt/sapper-mui

git clone https://github.com/vikignt/sapper-mui.git
cd sapper-mui
npm install
npm run dev

Navigate to localhost:3000

主要指標

概覽
名稱與所有者vikignt/svelte-mui
主編程語言Svelte
編程語言CSS (語言數: 4)
平台
許可證MIT License
所有者活动
創建於2019-08-07 13:17:38
推送於2024-09-17 20:39:28
最后一次提交2024-09-17 23:39:20
發布數6
最新版本名稱v0.3.1 (發布於 )
第一版名稱v0.1.0 (發布於 )
用户参与
星數317
關注者數13
派生數38
提交數224
已啟用問題?
問題數39
打開的問題數17
拉請求數10
打開的拉請求數6
關閉的拉請求數3
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?