svelte-bootstrap-icons
    TypeScript icon, indicating that this package has built-in type declarations

    1.8.2 • Public • Published

    svelte-bootstrap-icons

    NPM

    Bootstrap SVG icons as Svelte components.

    Try it in the Svelte REPL.


    Installation

    Yarn

    yarn add -D svelte-bootstrap-icons

    NPM

    npm i -D svelte-bootstrap-icons

    pnpm

    pnpm i -D svelte-bootstrap-icons

    Usage

    Refer to ICON_INDEX.md for a full list of supported icons.

    Base import

    <script>
      import {
        Alarm,
        Bank,
        CloudMoon,
        Github,
        PaintBucket,
        Wrench,
      } from "svelte-bootstrap-icons";
    </script>
    
    <Alarm />
    <Bank />
    <CloudMoon />
    <Github />
    <PaintBucket />
    <Wrench />

    Direct import (recommended)

    Import the icon directly for faster compiling during development.

    Note: even if using the base import method, unused imports are still tree shakeable by application bundlers like Rollup or webpack.

    <script>
      import Alarm from "svelte-bootstrap-icons/lib/Alarm";
      // OR
      import Alarm from "svelte-bootstrap-icons/lib/Alarm/Alarm.svelte";
    </script>

    Custom size

    $$restProps are forwarded to the svg element.

    Use the width and height attributes to customize the icon size. The default is 16px.

    <Alarm width={24} height={24} />

    Custom color

    Use the fill attribute to specify a custom color.

    <Alarm fill="red" />

    API

    Forwarded events

    • on:click
    • on:mouseover
    • on:mouseenter
    • on:mouseout
    • on:keydown

    Usage with svelte:component

    <script>
      import * as icons from "svelte-bootstrap-icons";
    </script>
    
    {#each Object.keys(icons) as icon}
      <div>
        <svelte:component this={icons[icon]} title={icon} />
        {icon}
      </div>
    {/each}

    TypeScript

    Svelte version 3.31 or greater is required to use this library with TypeScript.

    Changelog

    Changelog

    Contributing

    See the contributing guidelines.

    License

    MIT

    Install

    npm i svelte-bootstrap-icons

    DownloadsWeekly Downloads

    313

    Version

    1.8.2

    License

    MIT

    Unpacked Size

    2.47 MB

    Total Files

    8351

    Last publish

    Collaborators

    • metonym