# Icon — SvelteKit UI

Package: sveltekit-ui 1.1.94

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

Category: Foundations

renders an inline svg icon from a fixed set of icon_ids, with optional color, rotation, and animation

Public component import: `Icon`

Public manager import: `create_icon_manager`

## Usage

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

  const manager = create_icon_manager({
    icon_id: "check",
    color: "var(--success-t)",
    size: 2.4,
    sw: 40,
  })
</script>

<div style="display: flex; align-items: center; gap: 1rem;">
  <Icon {manager} /><span>Ready to publish</span>
</div>
```

## Configuration

### `icon_id`

- type: string
- default: null
- description: identifies the icon to render (e.g. 'arrow', 'check', 'trashcan').
- options:
  - arrow
  - arrow_tailed
  - calendar
  - yoga_tree
  - yoga_warrior
  - yoga_salute
  - reformer_seated
  - reformer_pike
  - reformer_stretch
  - runner_lunge
  - runner_stride
  - runner_finish
  - strength_rack
  - strength_press
  - strength_rest
  - float_ripple
  - float_rest
  - float_surface
  - sauna_bench
  - sauna_seated
  - sauna_towel
  - massage_table
  - massage_rest
  - massage_stones
  - session_bud
  - session_bloom
  - session_spark
  - yoga
  - pilates
  - fitness
  - massage
  - recovery
  - event
  - magnifying_glass
  - chart
  - row_item
  - chart_group
  - check
  - copy
  - drag_grip
  - edit
  - link
  - link_internal
  - list
  - minus
  - plus
  - rotate
  - refresh
  - sort
  - table
  - trashcan
  - x
  - three_dots
  - clock
  - sun
  - moon
  - smile_face
  - frown_face
  - nuetral_face
  - curved_arrow
  - pointer_hand
  - touch_circle
  - profile
  - share
  - invite
  - feedback
  - idea
  - ar_one_to_one
  - ar_four_to_three
  - ar_three_to_two
  - ar_sixteen_to_nine
  - crop
  - resize
  - save
  - folder
  - file
  - file_drop
  - file_dropped
  - file_add
  - linked
  - unlinked
  - sliders
  - brain
  - brush
  - redo_arrow
  - undo_arrow
  - opposing_arrows
  - photo
  - send
  - clipboard
  - download
  - heart
  - star
  - search
  - bolt
  - branch
  - branch_replace
  - branch_update
  - code
  - comment
  - gear
  - house
  - unlocked
  - locked
  - tag
  - play
  - pause
  - volume
  - speech
  - warning
  - reply
  - reply_all
  - forward
  - mail
  - mail_opened
  - mail_received
  - mail_sent
  - mail_sent_opened
  - pinpoint
  - paperclip
  - users
  - bell
  - ticket
  - credit_card
  - user_check
  - filter
  - repeat
  - receipt
  - globe
  - shield_check
  - list_clock
  - file_signature
  - bot
  - phone_inbound_answered
  - phone_inbound_missed
  - phone_outbound_answered
  - phone_outbound_missed

### `deg`

- type: number
- default: 0
- description: icon rotation in degrees

### `color`

- type: string
- default: var(--g4-t)
- description: stroke color for the icon; also colors filled details such as dots

### `color_alt`

- type: string
- default: var(--g12-t)
- description: alternate color (used in certain icons like 'sort' for ascending vs. descending). if not used, it falls back to the main color

### `fill`

- type: string
- default: none
- description: svg fill color (e.g., 'none' or a color hex)

### `size`

- type: number
- default: 2
- description: icon size in rem

### `sw`

- type: number
- default: 60
- description: stroke width setting for the icon; three_dots and drag_grip use circles with radius sw / 2 + 6

### `ml`

- type: number
- default: 0
- description: margin-left in rem

### `mr`

- type: number
- default: 0
- description: margin-right in rem

### `mt`

- type: number
- default: 0
- description: margin-top in rem

### `mb`

- type: number
- default: 0
- description: margin-bottom in rem

### `sort_state`

- type: string
- default: null
- description: used by the 'sort' icon to highlight ascending or descending arrow: 'asc', 'desc', or null

### `is_shimmy_infinite`

- type: boolean
- default: false
- description: if true, the icon keeps rotating slightly (shimmy) forever

### `is_shimmyable`

- type: boolean
- default: false
- description: if true, icon can be triggered to shimmy for 1s with trigger_shimmy()

### `movement_stiffness`

- type: number
- default: 0.1
- description: reserved for future motion config (svelte spring or similar)

### `movement_damping`

- type: number
- default: 0.1
- description: reserved for future motion config (svelte spring or similar)

### `id`

- type: string
- default: null
- description: unique id for the icon. if not provided, a random id is generated

## Methods

### `trigger_shimmy()`

- description: activates a shimmy animation for ~1 second, if is_shimmyable is true
- parameters:
- returns: void

### `set_attributes()`

- description: updates the manager's config based on a new input object
- parameters:
  - input: object
- returns: void

## Returned state

### `id`

- type: string
- description: unique id used in the dom for the icon container

### `icon_id`

- type: string
- description: current icon id specifying which path or group of paths is rendered

### `deg`

- type: number
- description: the icon's current rotation in degrees

### `deg_spring`

- type: number
- description: a placeholder for a svelte motion spring around deg (not fully implemented)

### `color`

- type: string
- description: the main stroke color

### `color_alt`

- type: string
- description: an optional alternate color, used in certain icons (e.g. 'sort')

### `fill`

- type: string
- description: the fill color for shapes in the svg

### `size`

- type: number
- description: the icon's width/height in rem

### `sw`

- type: number
- description: the icon's stroke width

### `ml`

- type: number
- description: margin-left in rem

### `mr`

- type: number
- description: margin-right in rem

### `mt`

- type: number
- description: margin-top in rem

### `mb`

- type: number
- description: margin-bottom in rem

### `sort_state`

- type: string
- description: if 'asc' or 'desc', the sort icon shows the alt color for either ascending or descending

### `is_shimmy_infinite`

- type: boolean
- description: if true, the icon is in a constant shimmy animation

### `is_shimmyable`

- type: boolean
- description: if true, the icon can be triggered to shimmy with trigger_shimmy()

### `movement_stiffness`

- type: number
- description: reserved for future usage with svelte motions

### `movement_damping`

- type: number
- description: reserved for future usage with svelte motions

### `is_shimmying`

- type: boolean
- description: true if the icon is currently shimmying in a short animation
