Skip to content

Commit

Permalink
Add component and props list
Browse files Browse the repository at this point in the history
  • Loading branch information
RJFelix committed Oct 31, 2023
1 parent 38b0914 commit 8ce8f12
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,37 @@ Userfront.init("myTenantId");
</body>
```

## Components

| React | Vue & Web Components |
| ----------------------- | --------------------------------------------- |
| `<SignupForm />` | `<signup-form></signup-form>` |
| `<LoginForm />` | `<login-form></login-form>` |
| `<PasswordResetForm />` | `<password-reset-form></password-reset-form>` |
| `<LogoutButton />` | `<logout-button></logout-button>` |

Note: when using them in plain HTML, Web Components are not self-closing and must have the full closing tag.
When using in Vue, they can be written in self-closing form: `<signup-form />`.

The Vue components are `<kebab-case>` because they are Web Components under the hood, and Web Components are required to be in kebab-case.

### Props

In React, props are `camelCase`. In Vue and Web Components, props are `kebab-case`, as required by the Web Components standard.

All props are optional.

- `tenantId` / `tenant-id`: your tenant ID, from the Userfront dashboard. If you call `Userfront.init("yourTenantId")` before using the components, it's not necessary to provide this prop.
- `compact`: if `true` and username/password is an allowed factor in your tenant's [authentication flow](https://userfront.com/dashboard/authentication), show a "Password" button. If `false`, show the username and password fields directly in the form's sign-on method selection view.
- Default: `false`
- `redirect`: controls if and where the form should redirect **after** sign-on. If `false`, the form does not redirect. If set to a path, redirects to that path. If empty, redirects [as configured in your Userfront dashboard](https://userfront.com/dashboard/paths).
- Default: `undefined`
- `redirectOnLoadIfLoggedIn` / `redirect-on-load-if-logged-in`: if `true` and the user is already logged in when they load the form, redirects per the `redirect` parameter. If `false`, do not redirect if the user is already logged in when they load the form.
- Default: `false`

## Development

## Repo structure
### Repo structure

This repo holds several different libraries.

Expand All @@ -97,7 +125,7 @@ This repo holds several different libraries.

The repo is configured as an npm workspace to enable sharing of libraries and dynamically linking the package to the dev app.

## Development installation and setup
### Development installation and setup

1. Clone this repo.
2. Install:
Expand All @@ -120,6 +148,6 @@ This will run the live dev servers for both the package and the site.
- Find the link to the local Storybook server in the output.
- Storybook should hot reload on changes to the package. Each UI state has its own component, so changes should show immediately and shouldn't require reloading the page.

## Architecture
### Architecture

See the `README.md` in `packages/toolkit-react` for a more detailed overview of the toolkit's architecture.

0 comments on commit 8ce8f12

Please sign in to comment.