Styled components
DoksJS allows you to create stylized components. Stylized components are components that are styled using CSS Modules. This means that the styles of the component are scoped to the component itself, which helps to avoid naming conflicts.
To create a stylized component, you need to create a component that extends the StylizedComponent
class. The StylizedComponent
class provides a number of methods that can be used to style the component.
For example, the following code creates a stylized component that styles a button:
This code creates a styled component called Button
. The Button
component extends the styled.button
component and styles the button with a black background color, white text, and 10px of padding.
You can also use the withStyles()
higher-order component to style a component. The withStyles()
higher-order component takes a function as an argument and returns a component that is styled using the function.
For example, the following code uses the withStyles()
higher-order component to style a button:
This code uses the withStyles()
higher-order component to style the Button
component using the styles
object.