okgrow/accounts-ui-react

Name: accounts-ui-react

Owner: OK GROW!

Description: The Meteor accounts-ui we know and love, wrapped in React.

Created: 2016-08-18 07:45:29.0

Updated: 2018-05-22 15:15:18.0

Pushed: 2018-02-10 09:35:32.0

Homepage: null

Size: 25

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

accounts-ui-react

The Meteor accounts-ui we know and love, wrapped in React.

Installation

Assuming you've already got a React project up and running:

Add the meteor package

or add okgrow:accounts-ui-react

Add the npm dependencies for this package

install --save react-komposer classnames

Add at least one accounts login provider. For example:

or add accounts-password
Basic Usage

Simply import and use the <LoginButtons /> component. For example:

rt React from 'react';
rt { LoginButtons } from 'meteor/okgrow:accounts-ui-react';

t App = () => (
iv>
<h1>App</h1>
<LoginButtons />
div>


rt default App;

Example at: https://github.com/okgrow/accounts-ui-react-example

Advanced Usage via Props
Visible

The login form is hidden by default with a dropdown behavior. If you want to show the dropdown by default, use the visible prop.

<LoginButtons visible />

State

Set the initial state of the login form using the state prop. Choose from signUp and forgotPassword. signIn is the default behavior.

<LoginButtons state="signUp" />

hideLinks

Stop your user changing the state using the hideLinks prop. A good example of this might be when you are separating our your signUp and signIn forms onto different routes.

<LoginButtons state="signUp" visible hideLinks />

This will generate a signUp form that the user can't toggle or hide.

Styles

We have made the styles a little simpler than the original ones, but recommend you skin the form to match your app.

Known limitations
static-html vs blaze-html-templates

This package uses the original Blaze accounts-ui package under the hood and is therefore incompatible with the static-html package. If you get this error when starting your app:

r: conflict: two packages included in the app (templating and static-html) are both trying to handle *.html

then you will need to run the following:

or remove static-html
or add blaze-html-templates
Target container is not a DOM element

If you remove this package as usual with meteor remove okgrow:accounts-ui-react, but don't have blaze-html-templatesinstalled, your app may fail to render, throwing an error in the browser console:

ught Invariant Violation: _registerComponent(...): Target container is not a DOM element.

To solve this, you can add either static-html or blaze-html-templates as appropriate to your app's needs.

Update Note
v0.8

Note that this package uses composeWithTracker, which was removed in Komposer2.0. In v0.8 of this package, the following snippet which was copied into composeWithTracker.js is used to bring back composeWithTracker's functionality. https://github.com/TobyEalden/react-komposer/blob/3c87a1724590cb24303a2c4d7ec8ed88f834e5db/README.md#for-meteors-tracker

Todo

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.