|
| 1 | +# Supabase UI |
| 2 | + |
| 3 | +Supabase UI is a React UI library. |
| 4 | + |
| 5 | +🚧 |
| 6 | +Supabase UI is still a work-in-progress until a major release is published. |
| 7 | + |
| 8 | +[](https://www.producthunt.com/posts/supabase-ui) |
| 9 | + |
| 10 | + |
| 11 | +[View docs](https://ui.supabase.com) |
| 12 | + |
| 13 | +## Install Supabase UI |
| 14 | + |
| 15 | +```cli |
| 16 | +npm install @supabase/ui |
| 17 | +``` |
| 18 | + |
| 19 | +## Using Supabase UI |
| 20 | + |
| 21 | +Example of importing a component |
| 22 | + |
| 23 | +```js |
| 24 | +import { Button } from '@supabase/ui' |
| 25 | + |
| 26 | +//... |
| 27 | + |
| 28 | +return <Button>I am a Supabase UI button</Button> |
| 29 | +``` |
| 30 | + |
| 31 | +It is probably advisable to use [Normalize](https://github.com/sindresorhus/modern-normalize) with Supabase UI for the timebeing. |
| 32 | + |
| 33 | +## Using Icons |
| 34 | + |
| 35 | +We use [Feather icon library](https://feathericons.com/) in Supabase UI |
| 36 | + |
| 37 | +You can use any Icon from the library as a component by prepending `Icon` to any Icon name, like, `<IconMail>` |
| 38 | + |
| 39 | +```js |
| 40 | +import { IconMail } from '@supabase/ui' |
| 41 | + |
| 42 | +//... |
| 43 | + |
| 44 | +return <IconMail size="small" /> |
| 45 | +``` |
| 46 | + |
| 47 | +## Using Supabase UI Auth |
| 48 | + |
| 49 | +You can use our Auth widget straight out the box with Supabase auth including social logins. |
| 50 | + |
| 51 | +<img width="380" alt="Screenshot 2021-02-05 at 19 25 01" src="https://user-images.githubusercontent.com/8291514/107029572-32f72d00-67ea-11eb-982e-e737f052eea1.png"> |
| 52 | + |
| 53 | + |
| 54 | +The Auth component also includes a context component which detects whether a user is logged in or not. |
| 55 | + |
| 56 | +Make sure to also install `@supabase/supabase-js` |
| 57 | + |
| 58 | +```cli |
| 59 | +npm install @supabase/supabase-js |
| 60 | +``` |
| 61 | + |
| 62 | +You can then easily import `Auth` from the ui library and pass the `createClient` to the `Auth` component. |
| 63 | + |
| 64 | +```js |
| 65 | +import { Auth, Typography, Button } from "@supabase/ui"; |
| 66 | +import { createClient } from "@supabase/supabase-js"; |
| 67 | + |
| 68 | +const { Text } = Typography |
| 69 | + |
| 70 | +// Create a single supabase client for interacting with your database |
| 71 | +const supabase = createClient( |
| 72 | + "https://xyzcompany.supabase.co", |
| 73 | + "public-anon-key" |
| 74 | +); |
| 75 | + |
| 76 | +const Container = (props) => { |
| 77 | + const { user } = Auth.useUser(); |
| 78 | + if (user) |
| 79 | + return ( |
| 80 | + <> |
| 81 | + <Text>Signed in: {user.email}</Text> |
| 82 | + <Button block onClick={() => props.supabaseClient.auth.signOut()}> |
| 83 | + Sign out |
| 84 | + </Button> |
| 85 | + </> |
| 86 | + ); |
| 87 | + return props.children; |
| 88 | +}; |
| 89 | + |
| 90 | +export default function Home() { |
| 91 | + return ( |
| 92 | + <Auth.UserContextProvider supabaseClient={supabase}> |
| 93 | + <Container supabaseClient={supabase}> |
| 94 | + <Auth providers={['facebook', 'github']} supabaseClient={supabase}/> |
| 95 | + </Container> |
| 96 | + </Auth.UserContextProvider> |
| 97 | + ); |
| 98 | +}; |
| 99 | +``` |
| 100 | + |
| 101 | +## Roadmap |
| 102 | + |
| 103 | +Some of these are a work in progress - we invite anyone to submit a [feature request](https://github.com/supabase/ui/issues/new?labels=enhancement&template=2.Feature_request.md) if there is something you would like to see. |
| 104 | + |
| 105 | +_General_ |
| 106 | + |
| 107 | +- [x] Button |
| 108 | +- [x] Typography |
| 109 | +- [x] Icon |
| 110 | +- [x] Image (work in progress) |
| 111 | + |
| 112 | +_Data Input_ |
| 113 | + |
| 114 | +- [x] Input |
| 115 | +- [x] InputNumber |
| 116 | +- [x] Select (custom select wip) |
| 117 | +- [x] Checkbox |
| 118 | +- [x] Radio |
| 119 | +- [x] Toggle |
| 120 | +- [ ] Upload |
| 121 | +- [ ] Slider |
| 122 | +- [ ] Date picker |
| 123 | +- [ ] Time picker |
| 124 | +- [ ] Form |
| 125 | + |
| 126 | +_Layout_ |
| 127 | + |
| 128 | +- [ ] ~~Layout~~ |
| 129 | +- [ ] ~~Grid (Flex)~~ |
| 130 | +- [x] Divider |
| 131 | +- [x] Space (Flex) |
| 132 | + |
| 133 | +_Display_ |
| 134 | + |
| 135 | +- [x] Card |
| 136 | +- [ ] Avatar |
| 137 | +- [x] Accordion |
| 138 | +- [x] Alert |
| 139 | +- [x] Badge |
| 140 | +- [x] Menu |
| 141 | +- [ ] Tooltips |
| 142 | +- [ ] Tables |
| 143 | +- [ ] Code block |
| 144 | + |
| 145 | +_Navigation_ |
| 146 | + |
| 147 | +- [x] Tabs |
| 148 | +- [ ] Breadcrumb |
| 149 | +- [x] Dropdown |
| 150 | +- [x] Menu |
| 151 | +- [ ] Page Header |
| 152 | +- [ ] Sidebar |
| 153 | +- [ ] Flyout menu |
| 154 | +- [ ] Steps |
| 155 | + |
| 156 | +_Overlay_ |
| 157 | + |
| 158 | +- [x] Modal |
| 159 | +- [x] Context Menu |
| 160 | +- [x] Drawer / SidePanel |
| 161 | +- [ ] Toast messages / Notification |
| 162 | +- [ ] Progress |
| 163 | +- [ ] Feeds / Timeline |
| 164 | + |
| 165 | +_Utility_ |
| 166 | + |
| 167 | +- [x] Loading |
| 168 | +- [x] Transition (work in progress) |
| 169 | + |
| 170 | +_Misc_ |
| 171 | + |
| 172 | +- [x] Storybook docs |
| 173 | +- [ ] Theming (in progress) |
| 174 | +- [x] Supabase Auth Elements |
| 175 | +- [x] Documentation website |
| 176 | + |
| 177 | +We would be keen to hear any feedback on this project. |
| 178 | + |
| 179 | +Feel free to [submit a question or idea here](https://github.com/supabase/supabase/discussions/category_choices) |
0 commit comments