Code Monkey home page Code Monkey logo

ui's Introduction

Supabase UI

Supabase UI is a React UI library.


Supabase UI is being deprecated.

We are moving the components to the main mono repo at github.com/supabase/supabase.

The auth component has been moved to it's own repo and package. github.com/supabase-community/auth-ui. You can also read the docs for auth ui here.


### โš ๏ธ Development is currently being worked on in alpha branch

Supabase UI will be using tailwind css classes and dropping support for CSS modules is in the alpha branch. This UI library will exclusively need to be used with tailwind.

The Auth component will be moved over to @supabase/auth-helpers.


๐Ÿšง Supabase UI is still a work-in-progress until a major release is published.

Product hunt

View docs


Install Supabase UI

npm install @supabase/ui

Using Supabase UI

Example of importing a component

import { Button } from '@supabase/ui'

//...

return <Button>I am a Supabase UI button</Button>

It is probably advisable to use Normalize with Supabase UI for the timebeing.

Using Icons

We use Feather icon library in Supabase UI

You can use any Icon from the library as a component by prepending Icon to any Icon name, like, <IconMail>

import { IconMail } from '@supabase/ui'

//...

return <IconMail size="small" />

Using Supabase UI Auth

You can use our Auth widget straight out the box with Supabase auth including social logins.

Screenshot 2021-02-05 at 19 25 01

The Auth component also includes a context component which detects whether a user is logged in or not.

Make sure to also install @supabase/supabase-js

npm install @supabase/supabase-js

You can then easily import Auth from the ui library and pass the createClient to the Auth component.

import { Auth, Typography, Button } from "@supabase/ui";
import { createClient } from "@supabase/supabase-js";

const { Text } = Typography

// Create a single supabase client for interacting with your database
const supabase = createClient(
  "https://xyzcompany.supabase.co",
  "public-anon-key"
);

const Container = (props) => {
  const { user } = Auth.useUser();
  if (user)
    return (
      <>
        <Text>Signed in: {user.email}</Text>
        <Button block onClick={() => props.supabaseClient.auth.signOut()}>
          Sign out
        </Button>
      </>
    );
  return props.children;
};

export default function Home() {
  return (
    <Auth.UserContextProvider supabaseClient={supabase}>
      <Container supabaseClient={supabase}>
        <Auth providers={['facebook', 'github']} supabaseClient={supabase}/>
      </Container>
    </Auth.UserContextProvider>
  );
};

Roadmap

Some of these are a work in progress - we invite anyone to submit a feature request if there is something you would like to see.

General

  • Button
  • Typography
  • Icon
  • Image (work in progress)

Data Input

  • Input
  • InputNumber
  • Select (custom select wip)
  • Checkbox
  • Radio
  • Toggle
  • Upload
  • Slider
  • Date picker
  • Time picker
  • Form

Layout

  • Layout
  • Grid (Flex)
  • Divider
  • Space (Flex)

Display

  • Card
  • Avatar
  • Accordion
  • Alert
  • Badge
  • Menu
  • Tooltips
  • Tables
  • Code block

Navigation

  • Tabs
  • Breadcrumb
  • Dropdown
  • Menu
  • Page Header
  • Sidebar
  • Flyout menu
  • Steps

Overlay

  • Modal
  • Context Menu
  • Drawer / SidePanel
  • Toast messages / Notification
  • Progress
  • Feeds / Timeline

Utility

  • Loading
  • Transition (work in progress)

Misc

  • Storybook docs
  • Theming (in progress)
  • Supabase Auth Elements
  • Documentation website

We would be keen to hear any feedback on this project.

Feel free to submit a question or idea here

ui's People

Contributors

0xflotus avatar angelmtztrc avatar ankitjena avatar awalias avatar ceo0x avatar chipilov avatar dhaiwat10 avatar easy-street avatar enochndika avatar galanteria01 avatar harshcut avatar harshithpabbati avatar i-pip avatar iamshankhadeep avatar jonthomp avatar joshenlim avatar kiwicopple avatar menor avatar mildtomato avatar mrkldshv avatar mryechkin avatar nazeeh21 avatar orhantozan avatar phamhieu avatar saltcod avatar stevenschmatz avatar tchief avatar thorwebdev avatar wallacemyem avatar yashkandalkar avatar

Stargazers

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

Watchers

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

ui's Issues

Icon supports fill color

Feature request

Is your feature request related to a problem? Please describe.

Currently Icon color prop is used only for icon border. I need Icon to support for fill color

Screenshot 2021-01-11 at 10 59 19 AM

Describe the solution you'd like

Screenshot 2021-01-11 at 10 59 26 AM

Bug: wrong css selectors being used

Bug report

Describe the bug

Checkbox uses [type='checkbox'] css selector, which is causing issues if there are other checkboxes on the page.
need to be .sbui-checkbox[type='checkbox']

feature: button color scheme

Feature request

Is your feature request related to a problem? Please describe.

Primary color is too bright compare to the current Supabase button color. It's difficult to see the white label.

Screenshot 2021-01-05 at 5 37 03 PM

@MildTomato edits -
A couple of other issues -

  • Button to be less rounded

  • Add text-shadows

  • font inheritance not working

Toggle onChange prop does not trigger when clicked

Bug report

The onChange prop of the toggle component does not trigger when the toggle is clicked

Able to do it hackily for now via this haha:

<div onClick={() => setToggle(!toggleActive}>
  <Toggle active={toggleActive} />
</div>

also (@MildTomato)

disabled prop seems to not be working

Bug: React hooks not working when testing components locally with 'npm link'

Bug report

Describe the bug

@MildTomato to update this bug report, need to add react hook back in and investigate. will post screenshots.

When testing components that use React hooks locally, using npm link (unpublished package) there seems to be a conflict with the React versions being used.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Go to UI library, 'npm link'
  2. UI library can then be used in another local project using @import @supabase/ui
  3. Use a component that uses a React Hook

Screenshots

If applicable, add screenshots to help explain your problem.

Screenshot 2020-12-29 at 12 59 03

System information

  • OS: [e.g. macOS, Windows]
  • Browser (if applies) [e.g. chrome, safari]
  • Version of supabase-js: [e.g. 6.0.2]
  • Version of Node.js: [e.g. 10.10.0]

Additional context

Add any other context about the problem here.

feature: danger variant for button

Feature request

Is your feature request related to a problem? Please describe.

For delete, remove action, we need a danger variant button

Checkbox checked prop does not persist if conditional is given

Bug report

I'm currently passing a conditional to the checked prop for the Checkbox component as such for example

<Checkbox checked={a.length === b.length}

a and b have different lengths at the beginning, but when a does have the same length as b, this error shows up

image

I'm also able to toggle the checkbox despite the conditional returning a boolean value

e.g a = [1, 2, 3] and b=[4, 5, 6], the checkbox will be checked correctly, but i can still click on the checkbox to uncheck it. It should remain checked due to the conditional

Initial v1 Release Components

Feat: Initial Components

General

  • Button

  • Typography
    support for titles, paragraphs and labels
    <Typography.Title level={1}>I am a h1</Typography.Title>

Nav (inc full width option)

  • Tabs
    support nesting - <Tabs><TabPane></Tabs>

Display

  • Card

Overlays

  • Modal

Data input (Text, Number, Email etc)

  • Input - Text field

  • InputNumber - number field

  • Radio
    support nesting - <Radio.Group><Radio></Radio.Group>

  • Select
    support nesting - <Select><Select.Option></Select>

  • Toggle

include icons and text labels inside text fields


Forms may need to use Uniforms
Uniforms component list

  • BoolField.tsx
  • DateField.tsx
  • ErrorField.tsx
  • ErrorsField.tsx
  • HiddenField.tsx
  • ListAddField.tsx
  • ListDelField.tsx
  • ListField.tsx
  • ListItemField.tsx
  • LongTextField.tsx
  • NestField.tsx
  • NumField.tsx
  • QuickForm.tsx
  • RadioField.tsx
  • SelectField.tsx
  • SubmitField.tsx
  • TextField.tsx

Checkbox unable to mark as checked via a prop

Bug report

I noticed that the Checkbox has no prop to mark it as checked or not:

image

We'll need to add a prop to mark the checkbox as checked, such as in the context of persistent data

e.g <Checkbox checked={true} />

Chore: Vertical layout <Toggle> to support right and left aligned labels

thanks @joshenlim for helping before thanks @joshenlim for helping before.

the spacing on the right due the layout of the toggle, its always left aligned with text/labels.
this will show the label/text aligned on one side, while the toggle is aligned on the opposite side - which is what it should of been anyway ๐Ÿ™ˆ

I'll also leave support for the horizontal layout as well on top of that, incase we wanted it to sit inside a horizontal form, which has the labels on the left in another column.

I'll get that implemented!

Originally posted by @MildTomato in #45 (comment)

Icon supports src file path

Feature request

Is your feature request related to a problem? Please describe.

Currently Icon component only supports feather icon pack using type prop.

<Icon type:'Loader' />

Can we support src file path to svg file?

Button type link doesn't apply style color

Bug report

Describe the bug

<Button onClick={onClick} type="link" size="small" style={{ color: '#bbbbbb' }}>
  Link Button
</Button>

color doesn't apply to button text. It always has default white color.

Button text still hard to read

Chore

Describe the chore

image

It's still a bit hard to read the text on the green button. It looks like there is a shadow there, but perhaps it's an inner text shadow? I think a better strategy is to take the button color, then darken() it 40% or so, and make that a text-shadow. (this is how the old stripe site used to do it, and it seems to work best on soft/light colors)

For comparison

inner shadow:

image

drop shadow:

image

feature: Customization

Feature request

Ability to customize / style each component

How it works now

it doesn't work at all, all the color variables are stuck in the ui lib and cannot be changed externally.
all colors are set as rgb() values, also resulting in overriding externally as a tedious job.

If someone wanted to implement a 'brand color' change, they would need to target with CSS every class name that would contain the brand color, and then overwrite it, and for every shade color. This isn't practical.

Proposal

! this would be a breaking change !

All color variables are stored in css variables (CSS custom properties).

With css variables, we can set the variable names inside tailwind config file, rather than hex color values.

All of our components, when exported, would have colors set like this:

.sbui-btn {
   background-color: '--color-brand-700'
}

in the target app, using the ui library, you would need a stylesheet, that's imported into all pages, that contains all the variables, like:

.root,
#root,
#docs-root {
  --color-brand-100: #367ee9;
  --color-brand-200: #a0aec0;
  --color-brand-300: #718096;
/* and so on */

This will then show the correct colors in your app, which can be modified and changed to whatever you like.

it would (maybe) then be possible to just load up the correct variables file, depending on which 'theme' you wanted to show.
(think slack themes)

downsides

css variables still isn't fully supported by all browsers

there is no support for ie

Screenshot 2021-01-12 at 10 27 02

this presents a problem, because if the css variables do not work, there is no fallback style -unless, we implement a fall back color for every variable, in every place it is used, in every component - this isn't a realistic solution really, and it would add a lot of redundant css.

[Auth] Persist email and password state across sign in and sign up

Feature request

Is your feature request related to a problem? Please describe.

When someone types in email and password in the sign in screen but doesn't have an account and then clicks on sign up, the email and password input fields are cleared and they have to retype it.

Describe the solution you'd like

Persist email and password states between sign in and sign up views

Transition class warning error on console

Bug report

Describe the bug

When using supabase/ui Button on a page. console will print warning error on page load.

Failed prop type: The prop `children` is marked as required in `CSSTransition`, 
but its value is `null`.

Screenshot 2021-01-07 at 10 38 51 AM

feature: beforeLabel & afterLabel props

Feature request

Is your feature request related to a problem? Please describe.

Screenshot 2021-01-05 at 20 21 09

ability to add text to Inputs before and after the main label to show additional helpful tips.

Unable to target checkbox label with classNames prop

Bug report

I'm trying to implement the Checkbox component but realised that the labels have font weight 500 by default. I tried to pass classNames to the checkbox component but it does not target the <span> tag in the label - I'm wondering if that might be possible?

e.g <Checkbox className="font-normal text-gray-500" />

image

The classes are getting added, but the labels aren't getting the styles

image

Button sizes seem quite big

Chore

Describe the chore

image

the red button is the default size, save/cancel is "tiny". It seems that the default button is quite large right? I think we are going to end up with a lot of "tiny" buttons on our dashboard

[Auth] Add message for sign up email confirmation

Feature request

Currently the auth component does not give a message when signing up when confirmation email is enabled.

We should add "Check your email for the confirmation link." as a message

Label on Input component is set to uppercase

Bug report

Version: 0.6.1

I noticed that the labels provided by prop to the Input component is always set as uppercase - wondering if this was intentional and if so, is there a way for me to pass a className to change it to lowercase?

Context is I'm starting to try using the form components row the editor side panels, starting with the row editor as such

image

Ideally the casing of the labels should follow that of the column name, which in this context should be lowercased.

Also, I'm thinking if by default it should just be capitalize rather than uppercased, such as that in the storybook examples?

Auth component

Feature request

Auth component that can use Supabase client

support for:
โ€ข social auth sign up / sign in
โ€ข email sign up / sign in form
โ€ข magic link form
โ€ข forgotten password form

A clear and concise description of what you want and what your use case is.

Describe the solution you'd like

A clear and concise description of what you want to happen.

Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

Additional context

Add any other context or screenshots about the feature request here.

tailwindcss divide color not rendering correctly in browser

Bug report

Describe the bug

Tailwind DivideColor styling is not being displayed correctly

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. use the following in Supabase-UI
<div class="divide-y divide-blue-300">
  <div class="text-center py-2">1</div>
  <div class="text-center py-2">2</div>
  <div class="text-center py-2">3</div>
</div>
  1. the above will render incorrectly, with borders being shown on the left and right.

There is also issues with having to explicitly state 'border-{style}' for it to display the borders sometimes.

Expected behavior

Should display like screenshot below.

Screenshots

Screenshot 2020-11-16 at 18 03 57
Screenshot 2020-11-16 at 18 03 47

System information

  • tailwind was bumped up to 1.9.6 locally (latest release)
  • chrome Version 86.0.4240.111 (Official Build) (x86_64)

Additional context

If can't fix, raise bug report with tailwindcss.

feature: button with icon only

Feature request

Is your feature request related to a problem? Please describe.

I need to create a button with icon on center. Trying to use icon props but it's left alignment.

Screenshot 2021-01-05 at 5 14 08 PM

Screenshot 2021-01-05 at 5 13 45 PM

Describe the solution you'd like

icon should be in the center. And the same for loading indicator on loading state.
Screenshot 2021-01-05 at 5 15 07 PM
Screenshot 2021-01-05 at 5 19 03 PM

feature: button with fullwidth option

Feature request

Is your feature request related to a problem? Please describe.

Screenshot 2021-01-06 at 10 08 44 AM

I need the button to fill the width and center label.

Describe the solution you'd like

Screenshot 2021-01-06 at 10 11 21 AM

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.