Git Product home page Git Product logo

qwik-feather-icons's Introduction

Feather Icons for Qwik

What is Feather?

Feather is a collection of simply beautiful open source icons. Each icon is designed on a 24x24 grid with an emphasis on simplicity, consistency, and flexibility.

This icon library supports Feather Icons v4.29.0.

Installation

npm install --save qwik-feather-icons

Usage

Include

You can import the icon(s) you need as usual:

import { ThumbsUpIcon } from "qwik-feather-icons";

or import them all at once:

import * as IconPack from "qwik-feather-icons";

export const App = component$(() => {
  return (
    <div>
      <IconPack.ThumbsUpIcon />
      <IconPack.BatteryChargingIcon />
    </div>
  );
});

Props

All icons have these optional props:

export interface IconProps {
    size?: number,
    color?: string,
    strokeWidth?: number,
    strokeLineCap?: string,
    strokeLineJoin?: string,
    class?: string
}

With default values defined in a defaultIconProps object:

export const defaultIconProps: IconProps = {
  size: 24,
  color: "currentColor",
  strokeWidth: 2,
  strokeLineCap: "round",
  strokeLineJoin: "round",
  class: ""
};

Icon Component

This icon library has an Icon component with a required prop called name:

import { Icon } from "qwik-feather-icons";

export const App = component$(() => {
  return (
    <div>
      <Icon name="battery-charging" /> { /* equivalent to <BatteryChargingIcon /> */ }
    </div>
  );
});

Although is better to use the <'Name'Icon /> variant (such as <ThumbsUpIcon />) because it wraps the actual inline <svg>.

IconContext

Feather icons use Qwik Context to simply apply default props to all icons. Use useContextProvider at the root of the app (or anywhere above the icons in the tree) and pass in a configuration object with props to be applied by default to all icons.

import { component$, useContextProvider } from "@builder.io/qwik";
import { IconContext, WifiOffIcon, ThumbsUpIcon } from "qwik-feather-icons";

export const App = component$(() => {
  const newDefaultProps = {
    size: 96,
    color: "hotpink",
    strokeWidth: 2,
    strokeLineCap: "round",
    strokeLineJoin: "round",
    class: "just an example"
  };

  useContextProvider(IconContext, newDefaultProps);

  return (
    <div>
      <ThumbsDownIcon /> { /* huge (96px) hotpink icon */ }
      <WifiOffIcon />    { /* same here */ }
    </div>
  );
});

License

This package is licensed under the MIT License.

Acknowledgment

Thanks to Cole Bemis for the Feather Project. Here is his website https://colebemis.com/.

qwik-feather-icons's People

Contributors

egmaleta avatar tzdesign avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

tzdesign

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.