logoAnt Design

⌘ K
  • Design
  • Development
  • Components
  • Blog
  • Resources
6.0.0-alpha.3
  • Components Overview
  • Changelog
    v6.0.0-alpha.3
  • General
    • Button
    • FloatButton
      5.0.0
    • Icon
    • Typography
  • Layout
    • Divider
    • Flex
      5.10.0
    • Grid
    • Layout
    • Masonry
      6.0.0
    • Space
    • Splitter
      5.21.0
  • Navigation
    • Anchor
    • Breadcrumb
    • Dropdown
    • Menu
    • Pagination
    • Steps
    • Tabs
  • Data Entry
    • AutoComplete
    • Cascader
    • Checkbox
    • ColorPicker
      5.5.0
    • DatePicker
    • Form
    • Input
    • InputNumber
    • Mentions
    • Radio
    • Rate
    • Select
    • Slider
    • Switch
    • TimePicker
    • Transfer
    • TreeSelect
    • Upload
  • Data Display
    • Avatar
    • Badge
    • Calendar
    • Card
    • Carousel
    • Collapse
    • Descriptions
    • Empty
    • Image
    • List
      DEPRECATED
    • Popover
    • QRCode
      5.1.0
    • Segmented
    • Statistic
    • Table
    • Tag
    • Timeline
    • Tooltip
    • Tour
      5.0.0
    • Tree
  • Feedback
    • Alert
    • Drawer
    • Message
    • Modal
    • Notification
    • Popconfirm
    • Progress
    • Result
    • Skeleton
    • Spin
    • Watermark
      5.1.0
  • Other
    • Affix
    • App
      5.1.0
    • ConfigProvider
    • Util
When To Use
Examples
base
With Icon
other status
custom status render
Custom Render Type
Custom Size
Custom Color
Download QRCode
Error Level
Advanced Usage
Custom semantic dom styling
API
StatusRenderInfo
Semantic DOM
Design Token
FAQ
About QRCode ErrorLevel
⚠️⚠️⚠️ Cannot scan the QR code?

QRCode

Components that can convert text into QR codes, and support custom color and logo.
Importimport { QRCode } from "antd";
GitHub
components/qr-codeIssueOpen issues
Docs
Edit this page
Versionsupported since 5.1.0
contributors
PopoverSegmented

Resources

Ant Design X
Ant Design Charts
Ant Design Pro
Pro Components
Ant Design Mobile
Ant Design Mini
Ant Design Web3
Ant Design Landing-Landing Templates
Scaffolds-Scaffold Market
Umi-React Application Framework
dumi-Component doc generator
qiankun-Micro-Frontends Framework
Ant Motion-Motion Solution
China Mirror 🇨🇳

Community

Awesome Ant Design
Medium
X
yuque logoAnt Design in YuQue
Ant Design in Zhihu
Experience Cloud Blog
seeconf logoSEE Conf-Experience Tech Conference

Help

GitHub
Change Log
FAQ
Bug Report
Issues
Discussions
StackOverflow
SegmentFault

Ant XTech logoMore Products

yuque logoYuQue-Document Collaboration Platform
AntV logoAntV-Data Visualization
Egg logoEgg-Enterprise Node.js Framework
Kitchen logoKitchen-Sketch Toolkit
Galacean logoGalacean-Interactive Graphics Solution
WeaveFox logoWeaveFox-AI Development with WeaveFox 🦊
xtech logoAnt Financial Experience Tech
Theme Editor
Made with ❤ by
Ant Group and Ant Design Community
loading

When To Use

Used when the text needs to be converted into a QR Code.

Examples

API

Common props ref:Common props

This component is available since antd@5.1.0

PropertyDescriptionTypeDefaultVersion
valuescanned textstring | string[]-string[]: 5.28.0
typerender typecanvas | svg canvas5.6.0
iconinclude image url (only image link are supported)string-
sizeQRCode sizenumber160
iconSizeinclude image sizenumber | { width: number; height: number }405.19.0
colorQRCode Colorstring#000
classNamesCustomize class for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, string> | (info: { props })=> Record<SemanticDOM, string>-
bgColorQRCode Background Colorstringtransparent5.5.0
borderedWhether has border stylebooleantrue
errorLevelError Code Level'L' | 'M' | 'Q' | 'H' M
boostLevelIf enabled, the Error Correction Level of the result may be higher than the specified Error Correction Levelbooleantrue5.28.0
statusQRCode statusactive | expired | loading | scannedactivescanned: 5.13.0
statusRendercustom status render(info: [StatusRenderInfo](/components/qr-code-cn#statusrenderinfo)) => React.ReactNode-5.20.0
stylesCustomize inline style for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, CSSProperties> | (info: { props })=> Record<SemanticDOM, CSSProperties>-
typerender typecanvas | svgcanvas5.6.0
valuescanned textstring-

StatusRenderInfo

typescript
type StatusRenderInfo = {
status: QRStatus;
locale: Locale['QRCode'];
onRefresh?: () => void;
};

Semantic DOM

Design Token

Global TokenHow to use?

FAQ

About QRCode ErrorLevel

The ErrorLevel means that the QR code can be scanned normally after being blocked, and the maximum area that can be blocked is the error correction rate.

Generally, the QR code is divided into 4 error correction levels: Level L can correct about 7% errors, Level M can correct about 15% errors, Level Q can correct about 25% errors, and Level H can correct about 30% errors. When the content encoding of the QR code carries less information, in other words, when the value link is short, set different error correction levels, and the generated image will not change.

For more information, see the: https://www.qrcode.com/en/about/error_correction

⚠️⚠️⚠️ Cannot scan the QR code?

If the QR code cannot be scanned for identification, it may be because the link address is too long, which leads to too dense pixels.

You can configure the QR code to be larger through size, or shorten the link through short link services.

base

Basic Usage.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
other status

The status can be controlled by the value status, four values ​​of active, expired, loading, scanned are provided.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Custom Render Type

Customize the rendering results by type, provide options canvas and svg.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Custom Color

Custom Color.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Error Level

set Error Level.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Custom semantic dom styling

You can customize the semantic dom style of QRCode by passing objects/functions through classNames and styles.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
With Icon

QRCode with Icon.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
custom status render

You can control the rendering logic of the QR code in different states through the value of statusRender.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
5.20.0
Custom Size

Custom Size.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Download QRCode

A way to download QRCode.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Advanced Usage

With Popover.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon

QR code expired

Scanned

QR-Code
QR-Code

Loading...

QR code expired

Scanned
QR-Code
QR-Code
  • root
    Root element, set flex layout, padding, background color, border, border radius and relative positioning styles
  • cover
    Cover element, set absolute positioning, z-index, background color and loading state overlay styles