Class NuvQrCode
- Namespace
- NuvTools.AspNetCore.Blazor.Components
- Assembly
- NuvTools.AspNetCore.Blazor.dll
Shows a QR code for a text: a link to open on a phone, a pairing code, a payment payload.
public class NuvQrCode : ComponentBase, IComponent, IHandleEvent, IHandleAfterRender
- Inheritance
-
NuvQrCode
- Implements
- Inherited Members
Examples
<NuvQrCode Value="https://example.com/pair#code=123456" Size="240" AriaLabel="Scan to pair" />
Remarks
Rendered as inline SVG by the encoder in this package (no JavaScript, no third-party library), so it is sharp at any size and works in WebAssembly and server rendering alike. The code is regenerated only when a parameter that changes it changes. For an image file (PDF, e-mail), use QrCodeImage.
Properties
AdditionalAttributes
Any other attribute is applied to the container.
[Parameter(CaptureUnmatchedValues = true)]
public IReadOnlyDictionary<string, object>? AdditionalAttributes { get; set; }
Property Value
AriaLabel
What a screen reader announces for the code.
[Parameter]
public string? AriaLabel { get; set; }
Property Value
Class
CSS class applied to the container.
[Parameter]
public string? Class { get; set; }
Property Value
DarkColor
Colour of the modules, as #rrggbb. Keep it dark on a light background: scanners expect contrast.
[Parameter]
public string DarkColor { get; set; }
Property Value
ErrorCorrection
How much damage the code tolerates.
[Parameter]
public QrCodeErrorCorrection ErrorCorrection { get; set; }
Property Value
LightColor
Background colour, as #rrggbb.
[Parameter]
public string LightColor { get; set; }
Property Value
QuietZone
Whether to draw the blank margin scanners rely on.
[Parameter]
public bool QuietZone { get; set; }
Property Value
Size
Width and height, in CSS pixels.
[Parameter]
public int Size { get; set; }
Property Value
Style
Inline style appended to the container's size.
[Parameter]
public string? Style { get; set; }
Property Value
Value
The text to encode. Nothing is drawn while it is empty.
[Parameter]
[EditorRequired]
public string? Value { get; set; }
Property Value
Methods
BuildRenderTree(RenderTreeBuilder)
Renders the component to the supplied RenderTreeBuilder.
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
__builderRenderTreeBuilder
OnParametersSet()
Method invoked when the component has received parameters from its parent in the render tree, and the incoming values have been assigned to properties.
protected override void OnParametersSet()