# Eye — SvelteKit UI

Package: sveltekit-ui 1.1.94

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

Category: Foundations

Interactive eye icon for toggling visibility, such as showing or hiding passwords. Supports customization of color and stroke width, and optional state binding.

Public component import: `Eye`

## Usage

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

  let is_visible = $state(false)
</script>

<Eye is_eye_shown={is_visible} on_change={(value) => { is_visible = value }} />
<p>{is_visible ? "The preview is visible." : "The preview is hidden."}</p>
```

## Properties

### `is_eye_shown`

- type: boolean
- default: false
- description: Determines whether the eye icon is shown (visible) or the eye_not icon.

### `is_bind_val`

- type: boolean
- default: false
- description: If true, toggles the internal state `is_eye_shown` when clicked.

### `eye_color`

- type: CSS color
- default: var(--g6-t)
- description: Color of the eye icon.

### `sw`

- type: number
- default: 30
- description: Stroke width of the eye icon lines.

### `on_change`

- type: function
- default: null
- description: Callback function triggered when the eye icon is toggled. Receives the new `is_eye_shown` state as an argument.
