QRCode
Displays a scannable QR code representing data such as URLs or text. Use to let users quickly access information by scanning with a smartphone or other device.
Anchor to propertiesProperties
- Anchor to accessibilityLabelaccessibilityLabelstringDefault: 'QR code' (translated to the user's locale)
A label that describes the purpose or contents of the QR code. When set, it will be announced to users using assistive technologies and will provide more context about what the QR code may do when scanned.
- Anchor to borderborder'base' | 'none'Default: 'base'
Set the border of the QR code.
base
: applies border that is appropriate for the element.none
: removes the border from the element.- Anchor to contentcontentstring
The content to be encoded in the QR code, which can be any string such as a URL, email address, plain text, etc. Specific string formatting can trigger actions on the user's device when scanned, like opening geolocation coordinates on a map, opening a preferred app or app store entry, preparing an email, text message, and more.
- string
A unique identifier for the element.
- Anchor to logologostring
URL of an image to be displayed in the center of the QR code. This is useful for branding or to indicate to the user what scanning the QR code will do. By default, no image is displayed.
- Anchor to onErroronError() => void
Invoked when the conversion of
content
to a QR code fails. If an error occurs, the QR code and its child elements will not be displayed.- Anchor to sizesize'base' | 'fill'Default: 'base'
The displayed size of the QR code.
fill
: the QR code will takes up 100% of the available inline-size and maintain a 1:1 aspect ratio.base
: the QR code will be displayed at its default size.
QRCodeElementProps
- accessibilityLabel
A label that describes the purpose or contents of the QR code. When set, it will be announced to users using assistive technologies and will provide more context about what the QR code may do when scanned.
string
- border
Set the border of the QR code. `base`: applies border that is appropriate for the element. `none`: removes the border from the element.
'base' | 'none'
- content
The content to be encoded in the QR code, which can be any string such as a URL, email address, plain text, etc. Specific string formatting can trigger actions on the user's device when scanned, like opening geolocation coordinates on a map, opening a preferred app or app store entry, preparing an email, text message, and more.
string
- id
A unique identifier for the element.
string
- logo
URL of an image to be displayed in the center of the QR code. This is useful for branding or to indicate to the user what scanning the QR code will do. By default, no image is displayed.
string
- onError
Invoked when the conversion of `content` to a QR code fails. If an error occurs, the QR code and its child elements will not be displayed.
() => void
- size
The displayed size of the QR code. `fill`: the QR code will takes up 100% of the available inline-size and maintain a 1:1 aspect ratio. `base`: the QR code will be displayed at its default size.
'base' | 'fill'
export interface QRCodeElementProps extends QRCodeProps$1 {
}
Anchor to eventsEvents
- Anchor to errorerror((event: CallbackEventListener<typeof tagName>) => void) | null
Invoked when the conversion of
content
to a QR code fails. If an error occurs, the QR code and its child elements will not be displayed.
QRCodeElementEvents
- error
Invoked when the conversion of `content` to a QR code fails. If an error occurs, the QR code and its child elements will not be displayed.
((event: CallbackEventListener<typeof tagName>) => void) | null
export interface QRCodeElementEvents {
/**
* Invoked when the conversion of `content` to a QR code fails.
* If an error occurs, the QR code and its child elements will not be displayed.
*/
error?: ((event: CallbackEventListener<typeof tagName>) => void) | null;
}
CallbackEventListener
(EventListener & {
(event: CallbackEvent<TTagName, TEvent>): void;
}) | null
CallbackEvent
TEvent & {
currentTarget: HTMLElementTagNameMap[TTagName];
}
Code
examples
Code
<s-qr-code content="https://shopify.com"></s-qr-code> <s-paragraph> Scan to visit <s-link href="https://shopify.com">Shopify.com</s-link> </s-paragraph>
Preview

Anchor to best-practicesBest Practices
- Always test that the QR code is scannable from a smartphone.
- Include a square logo if that’s what your customers are familiar with.
- Increase usability by adding a text description of what the QR code does.
- Always provide an alternate method for customers to access the content of the QR code.
- If the content is a URL, provide a
s-link
nearby. - If the content is data, provide a
s-button
to copy the data to the clipboard, or show the data in a readonlys-text-field
.
- If the content is a URL, provide a