Skip to content

Theme

React-Chrono provides a simple way to customize the appearance of your timeline cards by using the theme object. This object allows you to modify the colors of various elements in the card, such as the title, subtitle, detailed text, and media.

To customize the card's appearance, you can pass the theme object as a prop to the React-Chrono component. The theme object consists of key-value pairs that map to specific styles. For example, if you want to change the color of the title text, you can use the titleColor key and assign it a new color value.

Theme Object

PropertyDescription
cardBgColorSpecifies the background color of the card.
cardDetailsBackGroundIndicates the background color of the card details.
cardDetailsColorDefines the color of the text in the card details.
cardMediaBgColorSpecifies the background color of the media in the card.
cardSubtitleColorSpecifies the color of the card subtitle.
cardTitleColorDetermines the color of the card title.
detailsColorSpecifies the color of the text in the details section.
iconBackgroundColorDetermines the background color of the icon.
nestedCardBgColorSpecifies the background color of a nested card.
nestedCardDetailsBackGroundIndicates the background color of the details section of a nested card.
nestedCardDetailsColorDefines the color of the text in the details section of a nested card.
nestedCardSubtitleColorSpecifies the color of the subtitle in a nested card.
nestedCardTitleColorDetermines the color of the title in a nested card.
primarySpecifies the primary color used throughout the UI.
secondarySpecifies the secondary color used throughout the UI.
titleColorSpecifies the color of the title of the card.
titleColorActiveIndicates the color of the title of the active card.
toolbarBgColorSpecifies the background color of the toolbar.
toolbarBtnBgColorSpecifies the background color of the toolbar buttons.
toolbarTextColorSpecifies the text color of the toolbar buttons.

Example Usagef

Note: library provides a default theme for both light as well as dark mode.

jsx
<Chrono
  items={items}
  theme={{
    primary: "red",
    secondary: "blue",
    cardBgColor: "yellow",
    cardForeColor: "violet",
    titleColor: "black",
    titleColorActive: "red",
  }}
/>

By using the theme object, you can easily tailor the look and feel of your timeline to match the style of your project or brand.

Released under the MIT License.