Giter Site home page Giter Site logo

metonym / svelte-octicons Goto Github PK

View Code? Open in Web Editor NEW
9.0 2.0 0.0 1.85 MB

GitHub Octicons as Svelte components

Home Page: https://metonym.github.io/svelte-octicons/

License: MIT License

JavaScript 63.97% Svelte 36.03%
octicons primer github icons svg svelte svelte-component typescript-definitions icon-library svelte-components

svelte-octicons's Introduction

svelte-octicons

NPM

GitHub Octicons as Svelte components.

This library builds GitHub Primer Octicons as Svelte components with zero dependencies.

Try it in the Svelte REPL.


Installation

# Yarn
yarn add -D svelte-octicons

# npm
npm i -D svelte-octicons

# pnpm
pnpm i -D svelte-octicons

Usage

Refer to ICON_INDEX.md for a list of available icons.

Base import

$$restProps are forwarded to the svg element.

<script>
  import { Alert16, Diamond16, Rocket16, Video16 } from "svelte-octicons";
</script>

<Alert16 />
<Diamond16 />
<Rocket16 />
<Video16 />

Custom fill

<Alert16 fill="red" />

Usage with svelte:component

<script>
  import * as Octicons from "svelte-octicons";
</script>

{#each Object.entries(Octicons) as [octicon, component]}
  <div>
    <svelte:component this={component} />
    {octicon}
  </div>
{/each}

TypeScript

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

Changelog

Changelog

License

MIT

svelte-octicons's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar metonym avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

svelte-octicons's Issues

Add export for Svelte

I get this warning using svelte-octicons in SvelteKit:

10:51:37 AM [vite-plugin-svelte] WARNING: The following packages have a svelte field in their package.json but no exports condition for svelte.

[email protected]

Please see https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/faq.md#missing-exports-condition for details.

I think the change would mean adding a block to package.json like this:

// package.json
  "svelte": "./package/lib/index.js"
+ "exports": {
+   ".": {
+       "svelte": "./package/lib/index.js"
+   }
}

I'm happy to open a PR to add this.

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.