Theming
@orderly.network/react
has a default theme, but you can also customize the theme yourself.
Default theme
Colors
@orderly.network/react
uses the following colors:
-
Besides
base
, each color theme contains 3 colors:default
: The default shade of the colorlight
: A lighter shade than defaultdarken
: A darker shade than defaultcontrastText
: Text color, intended to contrast with default
-
base-contrast
defines color of texts. The library uses transparency to differentiate the importance of texts.
COLORS
Typography
@orderly.network/react
uses Manrope as the default font.
Rounded
name | size |
---|---|
default | 6px |
sm | 4px |
lg | 8px |
full | 9999px |
Customized theme
CSS Variables
You can change the color of elements through creating a theme.css
under the project. Simply add the following into the file, and import it for it to take effect:
CSS variables must be defined without color space function. See the Tailwind CSS documentation for more information.
❌ Don’t include the color space function or opacity modifiers won’t work
✅ Define your CSS variables as channels with no color space function
You can use the Theme tool that we provide to quickly create your own theme!
Style override
@orderly.network/react
provides the following two ways to override the style of components:
class
To override the style of a certain class. For example, if we want to modify the style of a button
component, we can achieve this by selecting the element using the class
selector.
For instance, to change the color of button
the component:
If you want to change the disabled
status of the button
component:
id
If you want to modify the style of a specific component, you can use the id selector to define the component’s style. For example, if you want to modify the style of the “Create Order” button:
Supported id
s are as below:
id | module | description |
---|---|---|
orderly-deposit-confirm-button | deposit | Deposit confirm button |
orderly-withdraw-confirm-button | withdraw | Withdraw confirm button |
orderly-assets-margin-deposit-button | assets | Deposit button |
orderly-assets-margin-withdraw-button | assets | Withdraw button |
orderly-order-entry-confirm-button | order | Order entry - confirm button |
orderly-position-cell-limit-close-button | positions | Position - limit close button |
orderly-position-cell-mark-close-button | positions | Position - market close button |
orderly-pending-cell-edit-button | pending orders | Edit pending order button |
orderly-pending-cell-cancel-button | pending orders | Cancel pending order button |
orderly-bottom-nav-bar-connect-button | bottom-nav-bar | bottom bar connect wallet button |
appIcons
You can add your logo to the indicated position in the diagram above using the following method:
main
The logo for the desktop version, it will be displayed in the top left corner of the page.
img
- Type:
string
- Required: false
component
- Type:
ReactNode
- Required: false
className
- Type:
string
- Required: false
secondary
The logo for the mobile web version, it will be displayed in the top right corner of the page and in the top left corner of the bottomSheet component.
img
- Type:
string
- Required: false
component
- Type:
ReactNode
- Required: false
className
- Type:
string
- Required: false