Giter VIP home page Giter VIP logo

salad_ui's Introduction

SaladUI

This library is my attemp to port shadcn ui to Phoenix Liveview Component.

Warning: this library is under heavy development and not ready for production

Installation

  1. Adding salad_ui to your list of dependencies in mix.exs:
def deps do
  [
    {:salad_ui, github: "bluzky/salad_ui"}
  ]
end
  1. Add custom color
  • Goto https://ui.shadcn.com/themes.
  • Choose a color → Copy code → Paste to your app.css file
  • Create new file tailwind.colors.json in your assets directory and paste following content
{
  "accent": {
    "DEFAULT": "hsl(var(--accent))",
    "foreground": "hsl(var(--accent-foreground))"
  },
  "background": "hsl(var(--background))",
  "border": "hsl(var(--border))",
  "card": {
    "DEFAULT": "hsl(var(--card))",
    "foreground": "hsl(var(--card-foreground))"
  },
  "destructive": {
    "DEFAULT": "hsl(var(--destructive))",
    "foreground": "hsl(var(--destructive-foreground))"
  },
  "foreground": "hsl(var(--foreground))",
  "input": "hsl(var(--input))",
  "muted": {
    "DEFAULT": "hsl(var(--muted))",
    "foreground": "hsl(var(--muted-foreground))"
  },
  "popover": {
    "DEFAULT": "hsl(var(--popover))",
    "foreground": "hsl(var(--popover-foreground))"
  },
  "primary": {
    "DEFAULT": "hsl(var(--primary))",
    "foreground": "hsl(var(--primary-foreground))"
  },
  "ring": "hsl(var(--ring))",
  "secondary": {
    "DEFAULT": "hsl(var(--secondary))",
    "foreground": "hsl(var(--secondary-foreground))"
  }
}
  1. Configure tailwind
  • Tell tailwind to extract class from SaladUI
  • Add custom color
  • Add tailwind plugin
module.exports = {
  content: [
    "../deps/salad_ui/lib/**/*.ex",
    ],
  theme: {
    extend: {
      colors: require("./tailwind.colors.json"),
    },
  },
  plugins: [
    require("@tailwindcss/forms"),
    require("@tailwindcss/typography"),
    require("tailwindcss-animate"),
    ...
  ]
}
  • Install tailwindcss-animate
cd assets
npm i -D tailwindcss-animate
# or yarn
yarn add -D tailwindcss-animate
  1. Configure tails SaladUI use tails to properly merge Tailwindcss classes
# config/config.exs

config :tails, colors_file: Path.join(File.cwd!(), "assets/tailwind.colors.json")

Development

Here is how to start develop SaladUI on local machine.

  1. Clone this repo
  2. Clone https://github.com/bluzky/salad_storybook in the same directory with SaladUI
  3. Start storybook
cd salad_storybook
mix phx.server

List of components

  • Accordion
  • ✅ Alert
  • Alert Dialog
  • ✅ Avatar
  • ✅ Badge
  • ✅ Breadcrumb
  • ✅ Button
  • ✅ Card
  • Carousel
  • ✅ Checkbox
  • Collapsible
  • Combobox
  • Command
  • Context Menu
  • ✅ Dialog
  • Drawer
  • ✅ Dropdown Menu
  • ✅ Form
  • Hover Card
  • ✅ Input
  • Input OTP
  • ✅ Label
  • ✅ Pagination
  • Popover
  • ✅ Progress
  • Radio Group
  • ✅ Scroll Area
  • ✅ Select
  • ✅ Separator
  • ✅ Sheet
  • ✅ Skeleton
  • ✅ Slider
  • Switch
  • ✅ Table
  • ✅ Tabs
  • ✅ Textarea
  • Tooltip

salad_ui's People

Contributors

bluzky avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.