# react-login-page **Repository Path**: uiw/react-login-page ## Basic Information - **Project Name**: react-login-page - **Description**: 一些`react`登录页面,安装后可以很快使用。 - **Primary Language**: TypeScript - **License**: MIT - **Default Branch**: main - **Homepage**: https://uiw.gitee.io/react-login-page - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2023-06-23 - **Last Updated**: 2024-01-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README




react-codemirror logo

React Login Pages



Downloads jsDelivr CDN npm bundle size
Build & Deploy Open in unpkg npm version




# Getting Started Encapsulated login page components based on `react-login-page` basic components are provided for quick installation and use. These components help streamline the process of creating login pages and offer flexible APIs for modifying and packaging these components. Welcome to choose from our encapsulated [login pages](https://uiwjs.github.io/react-login-page). We also welcome [recommendations](https://github.com/uiwjs/react-login-page/issues/new/choose) for more cool login pages, which we will turn into React components.

react-codemirror logo

For more login pages, install and use directly [here](https://uiwjs.github.io/react-login-page). ## React Login Page This component is designed to facilitate the development of additional login pages and offers a highly flexible API for modifying packaged login page components. ### Install ```bash npm install react-login-page --save ``` ### Usage ```jsx mdx:preview import React from 'react'; import Login, { Render } from 'react-login-page'; import Logo from 'react-login-page/logo'; const Demo = () => { return ( {({ fields, buttons, blocks, $$index }) => { return (
{blocks.logo} {blocks.title}
{buttons.submit} {buttons.reset}
); }}
Login Submit Reset
); }; export default Demo; ``` Change the control order by using **`index`**, Provide more flexible API encapsulation. ```jsx mdx:preview import React from 'react'; import Login, { Render } from 'react-login-page'; import Logo from 'react-login-page/logo-rect'; const Demo = () => { return ( {({ blocks, extra, $$index }, { fields, buttons }) => { return (
{blocks.logo} {blocks.title}
{fields .sort((a, b) => a.index - b.index) .map((item, idx) => { return (
); })}
{buttons .sort((a, b) => a.index - b.index) .map((item, idx) => { return React.cloneElement(item.children, { ...item.props, key: item.name + idx, }); })}
); }}
Login Remember me Submit Reset
); }; export default Demo; ``` ### `Logo` There are two default logos built-in, with a special way to import them. See below for reference: ```tsx import Logo from 'react-login-page/logo'; import Logo from 'react-login-page/logo-rect'; ``` ⚠️ If you don't use them, they won't be packaged. ```jsx mdx:preview import React from 'react'; import Logo from 'react-login-page/logo'; import LogoRect from 'react-login-page/logo-rect'; const Demo = () => { return (

); }; export default Demo; ``` ### `Login.Block` ```jsx import Login, { Block } from 'react-login-page'; Login Login ``` ```jsx mdx:preview import React from 'react'; import Login, { Render } from 'react-login-page'; const Demo = () => { const [name, setName] = React.useState(1); return ( {({ blocks, fields, $$index, extra }, data) => } {name} Login ); }; export default Demo; ``` ```jsx import { PropsWithChildren, AllHTMLAttributes } from 'react'; import { BlockTagType } from 'react-login-page'; export interface BlockProps extends AllHTMLAttributes { keyname?: string; /** * @deprecated use `keyname` */ name?: string; /** Can be shown or hidden with controls */ visible?: boolean; /** "index" refers to the use of indexes to control the order of controls, which can provide more flexible API encapsulation. */ index?: number; /** custom created element */ tagName?: T; } export declare const Block: { (props: PropsWithChildren>>): null; displayName: string; }; ``` ### `Login.Input` ```jsx import Login, { Input } from 'react-login-page'; ``` ```jsx mdx:preview import React from 'react'; import Login, { Render } from 'react-login-page'; const Demo = () => { return ( {({ blocks, fields, $$index, extra }, data) => ( )} extra content ); }; export default Demo; ``` ```tsx import React, { FC, PropsWithChildren } from 'react'; export interface InputProps extends React.InputHTMLAttributes { keyname?: string; /** * Used to define the name of form controls * @deprecated use `name` */ rename?: string; /** Can be shown or hidden with controls */ visible?: boolean; /** "index" refers to the use of indexes to control the order of controls, which can provide more flexible API encapsulation. */ index?: number; } export declare const Input: FC>; ``` **`Input`** can display **extra** content ```jsx Remember me ``` ```jsx mdx:preview import React from 'react'; import Login, { Render } from 'react-login-page'; import Logo from 'react-login-page/logo-rect'; const Demo = () => { return ( {({ blocks, fields, $$index, extra }, data) => { return ( ); }} Remember me ); }; export default Demo; ``` ### `Login.Textarea` ```jsx import Login, { Textarea } from 'react-login-page';