Giter Site home page Giter Site logo

ui's Introduction

Hoppscotch UI ALPHA

Welcome to hoppscotch-ui, a collection of presentational components for our web applications. This library is built using Vue 3 and Tailwind CSS. Preview the components in Histoire.

Installation

To install the library in your project, run the following command:

pnpm add @hoppscotch/ui

Setup

In your main.ts file, import the library and register it as a plugin:

import { createApp } from "vue"
import App from "./App.vue"
// Import the library
import { plugin as HoppUI } from "@hoppscotch/ui"

// Import the styles
import "@hoppscotch/ui/style.css"

const app = createApp(App)

// Register the library as a plugin
app.use(HoppUI)

app.mount("#app")

The Library uses Tailwind CSS under the hood, so you have to import the preset in your tailwind.config.ts file:

import preset from "@hoppscotch/ui/ui-preset"

export default {
  content: ["src/**/*.{vue,html}"],
  presets: [preset],
}

Usage

You can use the components in your Vue templates like this:

<template>
  <HoppButtonPrimary label="Click me" />
</template>

<script lang="ts" setup>
import { HoppButtonPrimary } from "@hoppscotch/ui"
</script>

If you're using unplugin-vue-components in your project, you can import the components like this without having to import them in the script section:

<template>
  <HoppButtonPrimary label="Click me" />
</template>

<script lang="ts" setup>
</script>

To configure resolve options for unplugin-vue-components, add the following to your vite.config.ts file:

import { defineConfig } from "vite"
import vue from "@vitejs/plugin-vue"
import Components from "unplugin-vue-components/vite"

export default defineConfig({
  plugins: [
    vue(),
    Components({
      resolvers: [
        // auto import components
        (name) => {
          if (name.startsWith("Hopp")) {
            return {
              importName: name,
              path: "@hoppscotch/ui",
            }
          }
        },
      ],
    }),
  ],
})

Histoire

We've included Histoire in this library which is similar to Storybook, to make it easy to play with the components in the browser. You can run Histoire in the browser with command

pnpm run story:dev

You can also use Histoire to create stories for your components and test them in different scenarios.

Versioning

This project follows Semantic Versioning but as the project is still pre-1.0. The code and the public exposed API should not be considered to be fixed and stable. Things can change at any time!

License

This project is licensed under the MIT License - see LICENSE for more details.



built with ❤︎ by the Hoppscotch Team and contributors.

ui's People

Contributors

anwarulislam avatar joeljacobstephen avatar liyasthomas avatar nivedin avatar xenomech avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ui's Issues

[bug]: theme files not bundled

Issue

Currently, the CSS file imported does not contain the design tokens such as color, themes, etc. As per Hoppscotch-common, we have accent-themes, base-themes, editor-themes, etc which sets up CSS variables that the components use. which should be included in the package bundle.

There is a theme.scss exported in package.json but it is missing from the bundle.

file-structure

[bug]: Errors in readme

Issue:

While trying out Hoppscotch/UI on a local project the installation methods mentioned in the README were not correct.

Errors encountered are:

  1. Hoppui is not a default export
  2. Import error in tailwind config
  3. styles were not imported properly

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.