SlateComponents to decouple styling #295
Replies: 2 comments
-
@udecode/dev @Hideman85 do you have any reference for the provider pattern? How would you tackle that with our current styling system: overridable default styles Fluent UI styling pattern |
Beta Was this translation helpful? Give feedback.
0 replies
-
Let's track this in #363 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Slate Components
Package:
@udecode/slate-plugins-components
In the current state, you can pass a custom component using the
component
option of each plugin.We also want to let people create slate "design system components" inside a single package: material-ui, antd,.. But it would be cumbersome to manually add the provided components to the options of each plugin.
Solution:
<SlateComponents components={slateComponents} />
provider.options.component
if defineduseSlateComponent(pluginKey)
if defined.div
for an element,span
for a mark.Fluent Components
Package
@udecode/slate-plugins-components-fluent
Dependency:
@udecode/slate-plugins-components
These components support css-in-js using the
styles
props.styles
option from rendering plugins.slateComponents
: minimal styling.slateStyledComponents
: full styling.createSlateStyledComponents: (slateComponents: SlateComponents) => SlateComponents
to override the styles ofslateComponents
slateStyledComponents
.SlateComponents
object.Components having dependency can have their own package for bundle size.
See #283 #230
Styling with css
As a good practice, all the slate nodes should have (nested) class names, so anyone can style these without
slate-components
or css-in-js solution.Beta Was this translation helpful? Give feedback.
All reactions