Convert Figma logo to code with AI

matyunya logosmelte

UI framework with material components built with Svelte and Tailwind CSS

1,529
114
1,529
110

Top Related Projects

33,595

๐ŸŒผ ๐ŸŒผ ๐ŸŒผ ๐ŸŒผ ๐ŸŒผ โ€ƒThe most popular, free and open-source Tailwind CSS component library

Tailwind Starter Kit a beautiful extension for TailwindCSS, Free and Open Source

Open-source UI component library and front-end development framework based on Tailwind CSS

A plugin that provides a basic reset for form styles that makes form elements easy to override with utilities.

Completely unstyled, fully accessible UI components, designed to integrate beautifully with Tailwind CSS.

Tailwind CSS components that support RTL languages & fully responsive based on Flexbox & CSS Grid with elegant Dark Mode ๐Ÿš€ โ˜„๏ธ.

Quick Overview

Smelte is a UI framework built with Svelte and Tailwind CSS. It combines the simplicity and performance of Svelte with the utility-first approach of Tailwind CSS, offering a set of customizable components for rapid web development.

Pros

  • Lightweight and fast due to Svelte's compilation process
  • Highly customizable components using Tailwind CSS utility classes
  • Seamless integration with Svelte projects
  • Responsive design out of the box

Cons

  • Limited ecosystem compared to more established UI frameworks
  • Requires knowledge of both Svelte and Tailwind CSS
  • Documentation could be more comprehensive
  • Fewer pre-built components compared to some other UI libraries

Code Examples

  1. Creating a button component:
<script>
  import { Button } from 'smelte';
</script>

<Button color="primary">Click me</Button>
  1. Using a card component:
<script>
  import { Card } from 'smelte';
</script>

<Card>
  <h2 class="text-xl mb-4">Card Title</h2>
  <p>Card content goes here.</p>
</Card>
  1. Implementing a modal:
<script>
  import { Modal, Button } from 'smelte';
  let showModal = false;
</script>

<Button on:click={() => showModal = true}>Open Modal</Button>

<Modal bind:open={showModal}>
  <h2 class="text-xl mb-4">Modal Title</h2>
  <p>Modal content goes here.</p>
</Modal>

Getting Started

To start using Smelte in your Svelte project:

  1. Install Smelte and its dependencies:
npm install smelte tailwindcss postcss autoprefixer
  1. Add Smelte to your rollup.config.js or webpack.config.js:
import smelte from 'smelte/rollup-plugin-smelte';

export default {
  // ... other config
  plugins: [
    svelte({
      // ... other svelte options
      preprocess: [
        smelte({
          purge: production,
          output: 'public/global.css',
          postcss: [],
          whitelist: [],
          whitelistPatterns: [],
          tailwind: {
            colors: {
              primary: '#b027b0',
              secondary: '#009688',
              error: '#f44336',
              success: '#4caf50',
            },
            darkMode: true,
          },
        }),
      ],
    }),
    // ... other plugins
  ],
};
  1. Import and use Smelte components in your Svelte files:
<script>
  import { Button, TextField } from 'smelte';
</script>

<TextField label="Username" />
<Button color="primary">Submit</Button>

Competitor Comparisons

33,595

๐ŸŒผ ๐ŸŒผ ๐ŸŒผ ๐ŸŒผ ๐ŸŒผ โ€ƒThe most popular, free and open-source Tailwind CSS component library

Pros of daisyUI

  • Larger component library with 40+ UI components
  • Highly customizable with easy theming options
  • Works with multiple frameworks (React, Vue, Svelte, etc.)

Cons of daisyUI

  • Requires Tailwind CSS as a dependency
  • Steeper learning curve for those unfamiliar with utility-first CSS
  • Less opinionated design, which may require more customization

Code Comparison

Smelte button example:

<Button color="primary" ripple={true}>
  Click me
</Button>

daisyUI button example:

<button class="btn btn-primary">
  Click me
</button>

Additional Notes

Smelte is specifically designed for Svelte, offering a more integrated experience for Svelte developers. It includes Material Design-inspired components and built-in dark mode support.

daisyUI, on the other hand, is framework-agnostic and provides a wider range of components. It leverages Tailwind CSS for styling, which allows for greater flexibility but may require more setup and configuration.

Both libraries aim to simplify UI development, but they cater to different preferences in terms of design philosophy and framework integration.

Tailwind Starter Kit a beautiful extension for TailwindCSS, Free and Open Source

Pros of tailwind-starter-kit

  • More comprehensive set of pre-built components and templates
  • Better documentation and examples for quick start
  • Larger community and support base

Cons of tailwind-starter-kit

  • Less focus on Svelte integration compared to Smelte
  • May require more customization for Svelte-specific projects
  • Potentially steeper learning curve for Svelte developers

Code Comparison

Smelte (Svelte component):

<Button color="primary" ripple={true}>
  Click me
</Button>

tailwind-starter-kit (HTML with Tailwind classes):

<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
  Click me
</button>

Summary

Smelte is specifically designed for Svelte projects with Tailwind CSS integration, offering a more streamlined experience for Svelte developers. tailwind-starter-kit provides a broader range of components and templates but may require additional work to integrate with Svelte. The choice between the two depends on the project's specific needs and the developer's familiarity with Svelte and Tailwind CSS.

Open-source UI component library and front-end development framework based on Tailwind CSS

Pros of Flowbite

  • Larger component library with more pre-built elements
  • Active development and frequent updates
  • Extensive documentation and examples

Cons of Flowbite

  • Heavier bundle size due to more components
  • Less focus on Svelte integration compared to Smelte

Code Comparison

Smelte button component:

<Button color="primary" ripple={true}>
  Click me
</Button>

Flowbite button component:

<button type="button" class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 mr-2 mb-2 dark:bg-blue-600 dark:hover:bg-blue-700 focus:outline-none dark:focus:ring-blue-800">
  Click me
</button>

Smelte focuses on Svelte integration and provides a more concise API, while Flowbite offers a wider range of customizable components with utility classes. Smelte's approach may be more suitable for Svelte-specific projects, whereas Flowbite's flexibility makes it adaptable to various frontend frameworks.

A plugin that provides a basic reset for form styles that makes form elements easy to override with utilities.

Pros of tailwindcss-forms

  • Seamless integration with Tailwind CSS, providing consistent styling
  • Lightweight and focused specifically on form elements
  • Extensive browser compatibility and accessibility features

Cons of tailwindcss-forms

  • Limited to form styling, lacking comprehensive UI components
  • Requires more custom styling for complex form layouts
  • No built-in JavaScript functionality for form validation or interactivity

Code Comparison

tailwindcss-forms:

<input type="text" class="form-input px-4 py-3 rounded-full">

Smelte:

<TextField label="Username" placeholder="Enter your username" />

Key Differences

  • Smelte is a full-featured UI component library for Svelte, while tailwindcss-forms focuses solely on form styling
  • tailwindcss-forms uses utility classes, whereas Smelte provides pre-built components
  • Smelte includes JavaScript functionality and state management, which tailwindcss-forms does not offer

Use Cases

  • Choose tailwindcss-forms for projects already using Tailwind CSS and requiring minimal form styling
  • Opt for Smelte when building Svelte applications with a need for comprehensive UI components and interactivity

Community and Maintenance

  • tailwindcss-forms is maintained by the Tailwind Labs team, ensuring long-term support and updates
  • Smelte is a community-driven project with less frequent updates but offers Svelte-specific optimizations

Completely unstyled, fully accessible UI components, designed to integrate beautifully with Tailwind CSS.

Pros of Headless UI

  • Framework-agnostic, supporting React, Vue, and Alpine.js
  • Highly accessible components with ARIA support out-of-the-box
  • Minimal styling for maximum flexibility and customization

Cons of Headless UI

  • Requires more setup and styling work compared to Smelte's pre-styled components
  • Limited set of components compared to Smelte's broader offering
  • Steeper learning curve for developers new to headless UI concepts

Code Comparison

Smelte (Button component):

<Button color="primary" ripple={true}>
  Click me
</Button>

Headless UI (Menu component with custom styling):

<Menu>
  <Menu.Button className="px-4 py-2 bg-blue-500 text-white rounded-md">
    Options
  </Menu.Button>
  <Menu.Items className="absolute mt-2 w-56 bg-white shadow-lg rounded-md">
    {/* Menu items */}
  </Menu.Items>
</Menu>

Summary

Headless UI offers more flexibility and framework support but requires more work for styling and setup. Smelte provides pre-styled components for quicker development but with less customization options. The choice depends on project requirements and developer preferences.

Tailwind CSS components that support RTL languages & fully responsive based on Flexbox & CSS Grid with elegant Dark Mode ๐Ÿš€ โ˜„๏ธ.

Pros of MerakiUI

  • Offers a wider range of pre-built components and templates
  • Designed to be framework-agnostic, usable with various JavaScript frameworks
  • Provides more detailed documentation and examples for each component

Cons of MerakiUI

  • Less integrated with Svelte compared to Smelte
  • May require more manual customization for Svelte-specific features
  • Lacks some of the Svelte-optimized performance benefits found in Smelte

Code Comparison

Smelte (Svelte-specific):

<Button color="primary" ripple={true}>
  Click me
</Button>

MerakiUI (Framework-agnostic):

<button class="px-4 py-2 font-medium tracking-wide text-white capitalize transition-colors duration-200 transform bg-blue-600 rounded-md hover:bg-blue-500 focus:outline-none focus:ring focus:ring-blue-300 focus:ring-opacity-80">
  Click me
</button>

Both repositories provide UI component libraries, but they cater to different needs. Smelte is specifically designed for Svelte applications, offering tighter integration and Svelte-optimized performance. MerakiUI, on the other hand, provides a more versatile solution that can be used across various frameworks, albeit with potentially more setup required for Svelte projects. The code comparison illustrates the difference in approach, with Smelte offering a more concise, Svelte-oriented syntax, while MerakiUI provides a more detailed, CSS-class-based structure that can be easily adapted to different frameworks.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

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

$ npm install smelte

or

$ yarn add smelte

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

const smelte = require("smelte/rollup-plugin-smelte");

plugins = [
  ...your plugins,
  smelte({
    purge: production,
    output: "public/global.css", // it defaults to static/global.css which is probably what you expect in Sapper
    postcss: [], // Your PostCSS plugins
    whitelist: [], // Array of classnames whitelisted from purging
    whitelistPatterns: [], // Same as above, but list of regexes
    tailwind: {
      theme: {
        extend: {
          spacing: {
            72: "18rem",
            84: "21rem",
            96: "24rem"
          }
        }
      }, // Extend Tailwind theme
      colors: {
        primary: "#b027b0",
        secondary: "#009688",
        error: "#f44336",
        success: "#4caf50",
        alert: "#ff9800",
        blue: "#2196f3",
        dark: "#212121"
      }, // Object of colors to generate a palette from, and then all the utility classes
      darkMode: true,
    }, // Any other props will be applied on top of default Smelte tailwind.config.js
  }),
]

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

import "smelte/src/tailwind.css";

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

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

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

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

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:

import Button from "smelte/src/components/Button";
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

NPM DownloadsLast 30 Days