# QrInput — SvelteKit UI

Package: sveltekit-ui 1.1.94

Page: https://www.sveltekit-ui.com/components/qr_input

Category: Input controls

Edits QR code content, dimensions, colors, and download controls with a live preview applied by Set Changes.

Public component import: `QrInput`

Public manager import: `create_qr_input_manager`

## Component notes

- data_shapes:
  - option_defaults:
    - data: https://www.sveltekit-ui.com
    - image: inline library logo SVG (set image: '' to omit it)
    - margin: 40
    - size: 1000
    - image_size: 0.5
    - type_number: 0
    - border_radius: 10
    - border_width: 5
    - error_correction_level: Q
    - color: null
    - corner_color: null
    - background_color: null
    - border_color: null
    - is_show_copy: true
    - is_show_download: true
  - ranges: size: 100..2000px; margin: 0..100px; image_size: 0..1; type_number: integer 0..40 (0 automatic); border_radius: 0..50rem; border_width: 0..10px; error_correction_level: 'L' | 'M' | 'Q' | 'H'. Preview display_size is fixed at 280px; size controls generated output resolution.
- notes:
  - Qr manages browser rendering and cleanup; the preview does not generate its image on the server. The current controls are available through val before Set Changes is selected.

## Usage

```svelte
<script>
  // Import the shared stylesheet once in your application's root layout.
  import "sveltekit-ui/style.css"
  import { QrInput, create_qr_input_manager } from "sveltekit-ui"

  let applied_options = $state(null)

  const manager = create_qr_input_manager({
    val: { data: "https://svelte.dev", size: 600, margin: 20, image: "" },
    on_change: (value) => { applied_options = value },
  })
</script>

<QrInput {manager} />
{#if applied_options}<pre>{JSON.stringify(applied_options, null, 2)}</pre>{/if}
```

## Configuration

### `val`

- type: object
- default:
- description: Initial options: { data, image, size, margin, image_size, type_number, border_radius, border_width, error_correction_level, color, corner_color, background_color, border_color, is_show_copy, is_show_download }. Colors use ColorInput values { l, c, h, o, is_dark_theme_invert }, not CSS strings.

### `on_change`

- type: function
- description: Called as on_change(options) after Set Changes applies the current controls to the QR preview. It is not fired for each individual field edit.

## Methods

### `set_changes()`

- returns: Promise<void>
- description: Apply val plus display_size: 280 to qr_manager.update(), then call on_change with a copy of val.

## Returned state

### `val`

- type: object
- description: Current option values derived from all editor child managers.

### `qr_manager`

- type: object
- description: Qr preview manager, including rendering status and error_message.

### `margin_slider_manager`

- type: object
- description: Child UI manager rendered by QrInput.

### `size_slider_manager`

- type: object
- description: Child UI manager rendered by QrInput.

### `image_size_slider_manager`

- type: object
- description: Child UI manager rendered by QrInput.

### `type_number_slider_manager`

- type: object
- description: Child UI manager rendered by QrInput.

### `border_radius_slider_manager`

- type: object
- description: Child UI manager rendered by QrInput.

### `border_width_slider_manager`

- type: object
- description: Child UI manager rendered by QrInput.

### `error_correction_level_dropdown_manager`

- type: object
- description: Child UI manager rendered by QrInput.

### `color_manager`

- type: object
- description: Child UI manager rendered by QrInput.

### `corner_color_manager`

- type: object
- description: Child UI manager rendered by QrInput.

### `background_color_manager`

- type: object
- description: Child UI manager rendered by QrInput.

### `border_color_manager`

- type: object
- description: Child UI manager rendered by QrInput.

### `data_text_input_manager`

- type: object
- description: Child UI manager rendered by QrInput.

### `image_text_input_manager`

- type: object
- description: Child UI manager rendered by QrInput.

### `is_show_copy_checkbox_manager`

- type: object
- description: Child UI manager rendered by QrInput.

### `is_show_download_checkbox_manager`

- type: object
- description: Child UI manager rendered by QrInput.

### `set_changes_button_manager`

- type: object
- description: Child UI manager rendered by QrInput.
