svelteuidev / svelteui

SvelteUI Monorepo
https://svelteui.dev
MIT License
1.28k stars 64 forks source link

Documentation about interoperability #355

Open notramo opened 1 year ago

notramo commented 1 year ago

If designing an application requires creating custom components which are specific to that application, what are the guidelines for creating components that are interoperable with this library? E.g. How to style them? Is there some getContext() that should be used?

BeeMargarida commented 1 year ago

We don't have documentation about best practices for this yet, but rule of thumb would be:

  1. Use SvelteUIProvider in the root layout of your app, this will allow you to set a global theme and deal with the light/dark theme switch
  2. If you want to make a component that uses a SvelteUI component under the hood, you can apply your custom styles with createstyles - https://www.svelteui.org/theming/override. for example

Basically the theming section of the docs talks a bit about this, there are different ways of dealing with theme and style override, you should choose what works best for you. However, theming is not yet finalized, so we might change some things until the 1.0 version