1.0.5 β€’ Published 1 year ago

qwik-ionicons v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

⚑️ Ionicons for Qwik

  1. Are you using the Qwik framework πŸ”—?
  2. Do you want to use Ionicons πŸ”—?
  3. Would you like to have full control over the icon SVGs in JSX?

Then this library is perfect for you!

πŸ“– Table of contents

βš’οΈ Installation

NPM:

npm add qwik-ionicons

Yarn:

yarn add qwik-ionicons

🐣 Icon search

You need an icon? Go to:

➑️ Ionicons + Search πŸ”Ž

Pick an icon and remember its name.

An example (remember the marked name): Ionicons website, icon search

🍽️ Usage

You found an icon and have its name? Perfect! πŸŽ‰

Rewrite the name using Pascal Case. So flash-outline becomes FlashOutline.

Now you can import FlashOutline straight from the library:

import { FlashOutline } from "qwik-ionicons";

Here is an example component:

import { FlashOutline } from "qwik-ionicons";

export default component$(() => {
    return <FlashOutline width="64" data-test="flash-icon" />
})

βš™οΈ Props

The following attributes are typed:

  • id: string
  • class: string
  • width: string
  • height: string
  • style: { /* CSS style object */ }

All other props are passed as well! You could, for example, pass test IDs like so:

export default component$(() => {
    return <FlashOutline width="64" data-test="flash-icon" />
})

🌈 Styling

All SVGs will have the class ionicon. This allows you to define global default styles for all ionicons using CSS.

πŸ“ Size

You can use CSS class styles or inline CSS style to set the size per Icon.

If you need a default size for all ionicons, make use of the class ionicon.

🎨 Color

All SVGs make use of the currentColor property. By default, the icons will use the same color as the current text color. To adjust an icon's color, you just need to change the text color (CSS attribute color).

For that, you can use:

  • CSS classes,
  • inline style,
  • Tailwind classes,
  • ... or whatever you like :)

🏎️ SVG/HTML footprint

The library is constructed using Qwik's component$ method.

Every single icon variant is one component.

This means:

  • You make use of Qwik's usual JS optimization feature.
  • Only the icons you use are ever imported/loaded.
  • The server pre-renders initially visible icons.

❀️ Kudos

  1. Big Kudos to the Ionic-Team for creating the awesome Ionicons collection! ❀️
  2. Thanks dear Qwik-Team for making it so simple to create a Qwik component library! ❀️

🩹 Problems?

Feel free to create a GitHub issue. Thanks for reporting any problems! ☺️

πŸ¦” Author

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago