logoAnt Design

⌘ K
  • Design
  • Development
  • Components
  • Blog
  • Resources
YouMindTRACTIANLobeHubCodeRabbit
6.5.0
  • Components Overview
  • Changelog
    v6.5.0
  • General
    • Button
    • FloatButton
    • Icon
    • Typography
  • Layout
    • Divider
    • Flex
    • Grid
    • Layout
    • Masonry
      6.0.0
    • Space
    • Splitter
  • Navigation
    • Anchor
    • Breadcrumb
    • Dropdown
    • Menu
    • Pagination
    • Steps
    • Tabs
  • Data Entry
    • AutoComplete
    • Cascader
    • Checkbox
    • ColorPicker
    • 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
    • Segmented
    • Statistic
    • Table
    • Tag
    • Timeline
    • Tooltip
    • Tour
    • Tree
  • Feedback
    • Alert
    • Drawer
    • Message
    • Modal
    • Notification
    • Popconfirm
    • Progress
    • Result
    • Skeleton
    • Spin
    • Watermark
  • Other
    • Affix
    • App
    • BorderBeam
      6.4.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 pageLLMs.md
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
For Agents
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

PropertyDescriptionTypeDefaultVersionGlobal Config
valuescanned textstring | string[]-string[]: 5.28.0×
typerender typecanvas | svgcanvas5.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>-6.0.06.0.0
bgColorQRCode Background Colorstringtransparent5.5.0×
marginSizeQuiet zone size (in modules). 0 means no marginnumber06.2.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) => 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>-6.0.06.0.0

StatusRenderInfo

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

Semantic DOM

Design Token

Global TokenHow to use?
Token NameDescriptionTypeDefault Value
colorSplitUsed as the color of separator, this color is the same as colorBorderSecondary but with transparency.stringrgba(5,5,5,0.06)
colorTextDefault text color which comply with W3C standards, and this color is also the darkest neutral color.stringrgba(0,0,0,0.88)
colorWhitePure white color don't changed by themestring#fff
borderRadiusLGLG size border radius, used in some large border radius components, such as Card, Modal and other components.number8
controlHeightThe height of the basic controls such as buttons and input boxes in Ant Designnumber32
fontFamilyThe font family of Ant Design prioritizes the default interface font of the system, and provides a set of alternative font libraries that are suitable for screen display to maintain the readability and readability of the font under different platforms and browsers, reflecting the friendly, stable and professional characteristics.string-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'
fontSizeThe most widely used font size in the design system, from which the text gradient will be derived.number14
lineHeightLine height of text.number1.5714285714285714
lineTypeBorder style of base componentsstringsolid
lineWidthBorder width of base componentsnumber1
marginXSControl the margin of an element, with a small size.number8
paddingSMControl the small padding of the element.number12

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
6.0.0
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