# @antdp/user-login

> 用户登录页面

Latest version **2.1.2** (published 2025-02-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @antdp/user-login
pnpm add @antdp/user-login
yarn add @antdp/user-login
bun add @antdp/user-login
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; has provenance; high maintenance score.

Warnings: low downloads.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 2.1.2 |
| Published | 2025-02-11 |
| First published | 2020-05-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 34.6 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 18 |
| Maintainers | uiwjs, wcjiang |
| Keywords | login, antdp, antd |

## Links

- npm: https://www.npmjs.com/package/@antdp/user-login
- Repository: https://github.com/antdpro/antdp.git#master
- Homepage: https://antdpro.github.io/antdp
- Issues: https://github.com/antdpro/antdp/issues
- npm.io page: https://npm.io/package/@antdp/user-login

## Dependencies (4)

- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ~7.20.1
- [@antdp/antdp-ui](https://npm.io/package/@antdp/antdp-ui.md) 2.1.2
- [@ant-design/icons](https://npm.io/package/@ant-design/icons.md) ~5.3.5
- [@antdp/document-title](https://npm.io/package/@antdp/document-title.md) 2.1.2

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 2.1.2 (latest) — 2025-02-11
- 2.0.0-bate.5 (bate) — 2023-04-01
- 2.1.1 — 2024-03-28
- 2.0.24 — 2024-03-28
- 2.0.23 — 2023-11-10
- 2.0.22 — 2023-10-11
- 2.0.21 — 2023-08-22
- 2.0.20 — 2023-06-21
- 2.0.19 — 2023-06-12
- 2.0.18 — 2023-06-10
- 2.0.17 — 2023-06-09
- 2.0.16 — 2023-06-07
- 2.0.15 — 2023-05-30
- 2.0.14 — 2023-05-29
- 2.0.13 — 2023-05-28
- … 101 more at https://npm.io/package/@antdp/user-login/versions

## README

@antdp/user-login
---

[![npm](https://img.shields.io/npm/v/@antdp/user-login.svg?maxAge=3600)](https://www.npmjs.com/package/@antdp/user-login)
[![npm download](https://img.shields.io/npm/dm/@antdp/user-login.svg?style=flat)](https://www.npmjs.com/package/@antdp/user-login)

登录界面

## Installation

```bash
$ npm i @antdp/user-login --save
```


## 基本使用

```tsx  mdx:preview
import React, { useRef } from 'react';
import UserLogin from '@antdp/user-login';

const Demo= (props) => {
  return (
    <UserLogin
      warpStyle={{minHeight:"300px"}}
      projectName="Ant Design"
      loading={props.loading}
      onFinish={(values,submitType) => {
        console.log("打印保存参数---->",value,submitType)
      }}
      onSend={() => console.log('短信验证回调')}
      formBtns={[
        {
          label: '登录',
          attr: {
            type: 'primary',
            htmlType: 'submit',
            style: {
              marginRight: 20,
            },
          },
        },
        {
          label: '重置',
          attr: {
            type: 'primary',
          },
        },
      ]}
    />
  )
}
export default Demo;
```

## 账号登录

```tsx  mdx:preview
import React, { useRef } from 'react';
import UserLogin from '@antdp/user-login';

const Demo= (props) => {
  return (
    <UserLogin
      warpStyle={{minHeight:"300px"}}
      projectName="Ant Design"
      loading={props.loading}
      onFinish={(values) => {
       console.log("打印保存参数---->",values)
      }}
      type="account"
      formBtns={[
        {
          label: '登录',
          attr: {
            type: 'primary',
            htmlType: 'submit',
            style: {
              marginRight: 20,
            },
          },
        },
        {
          label: '重置',
          attr: {
            type: 'primary',
          },
        },
      ]}
    />
  )
}
export default Demo;
```

## 手机号登录

```tsx  mdx:preview
import React, { useRef } from 'react';
import UserLogin from '@antdp/user-login';

const Demo= (props) => {
  return (
    <UserLogin
      warpStyle={{minHeight:"300px"}}
      projectName="Ant Design"
      loading={props.loading}
      onFinish={(values) => {
       console.log("打印保存参数---->",values)
      }}
      type="phone"
      onSend={() => console.log('短信验证回调')}
      formBtns={[
        {
          label: '登录',
          attr: {
            type: 'primary',
            htmlType: 'submit',
            style: {
              marginRight: 20,
            },
          },
        },
        {
          label: '重置',
          attr: {
            type: 'primary',
          },
        },
      ]}
    />
  )
}
export default Demo;
```

## API
### 该组件依赖
- [antd Button](https://ant.design/components/button-cn) 
- [antd Radio](https://ant.design/components/radio-cn)
- [antd Form](https://ant.design/components/form-cn)

| 参数 | 说明 | 类型 | 默认值 |
| -------- | -------- | -------- | -------- |
| logo | logo | string  | - |
| projectName | 项目名称 | `string` | - |
| className | 登陆样式 | `string` | - |
| type | 登录类型 | `account \| phone \| account` |
| children | 自定义内容 |  `React.ReactNode` | - |
| formItems | 账号登录设置的formItem |   `({ render?: React.ReactNode, inputProps?: InputProps } & FormItemProps)[]` | - |
| formBtns | 表单操作按钮 |   `{ label?: React.ReactNode, attr?: ButtonProps }[]` | - |
| loading | 加载状态 |   `boolean` | - |
| onFinish | 表单提交 |   `(value: any, submitType: "account"   \| "phone") => void` | - |
| phoneFormItems | 手机号登录设置的 formItem 项 |   `UserLoginProps["formItems"]` | - |
| phoneCodeProps | 手机号FormItem 属性 |   `FormItemProps` | - |
| onSend | 自定义form表单内渲染 |   `() => void` | - |
| warpStyle | 外层样式 |   `React.CSSProperties` | - |
| titleStyle | 标题样式 |   `React.CSSProperties` | - |

---
_Source: https://npm.io/package/@antdp/user-login · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
