Giter VIP home page Giter VIP logo

Comments (4)

brunnerh avatar brunnerh commented on May 13, 2024 1

@metonym
I guess that is fine then; turning SVGs into components is not that difficult and does not necessarily need to be handled by the library.

By the way, there are still some direct references to carbon-icons-svelte in prop documentation, e.g. for Button:

  /**
   * Specify the icon from `carbon-icons-svelte` to render
   * @type {typeof import("svelte").SvelteComponent}
   */
  export let icon = undefined;

from carbon-icons-svelte.

metonym avatar metonym commented on May 13, 2024

Why not cast a custom icon to a CarbonIcon type?

from carbon-icons-svelte.

brunnerh avatar brunnerh commented on May 13, 2024

The issue is that there is no actual "casting" here, you can only make type assertions, which do not change the runtime type. CarbonIcon provides a specific interface via props and events which are used by the Carbon components, however, the user of the icons library never really interacts with this API directly, so it would be useful if the icon library could provide a way of creating components with the correct interface, so the API can change independently without issues.

If e.g. an icons would at some point expose a new event which is required by some Carbon component to work correctly and my icon component code is out of date, things would stop working. So for the user of these libraries it would be convenient to have something like my icon function implemented in the library, that takes an SVG/size as input and returns a valid icon that has the exact same functionality as all the standard icons.

from carbon-icons-svelte.

metonym avatar metonym commented on May 13, 2024

@brunnerh Resolved by carbon-design-system/carbon-components-svelte#853?

from carbon-icons-svelte.

Related Issues (20)

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.