diff --git a/docs/guides/configuration.md b/docs/guides/configuration.md index fc17a37..822f5db 100644 --- a/docs/guides/configuration.md +++ b/docs/guides/configuration.md @@ -6,32 +6,36 @@ description: You can learn about the configuration in the documentation of the D # Configuration -## Loading data for cards +## Load data for cards -To load data, add data to the [`data`](/api/config/booking-data) array. See all instructions here: [`Loading data`](/guides/loading-data). +Pass card objects to the [`data`](/api/config/booking-data) array of the Booking configuration. For the full data format and loading scenarios, see the [Loading data](/guides/loading-data) guide. -## Defining the structure of cards +## Define the structure of cards -You can configure what information all cards will display on their left side using the [`cardShape`](/api/config/booking-cardshape) property or the [`cardTemplate`](/api/config/booking-cardtemplate) property, which also allows customizing the appearance of each card's block. +The left side of each card displays a fixed set of data fields. To control which fields appear or to fully replace the default layout, use one of the following properties: + +- [`cardShape`](/api/config/booking-cardshape) — toggle visibility of the default fields +- [`cardTemplate`](/api/config/booking-cardtemplate) — replace the default layout with custom HTML :::info -`cardTemplate` helps completely customize the appearance of a card by providing your own custom HTML. It gives full control over the card's layout, design and content. -`cardShape` allows you only to modify the default template by hiding/showing fields. -If both are applied, `cardTemplate` will override the `cardShape` settings. +The `cardTemplate` property fully customizes a card's appearance through custom HTML and gives full control over layout, design, and content. The `cardShape` property only hides or shows fields of the default template. If you apply both, `cardTemplate` overrides the `cardShape` settings. ::: -On the left side of each card the following data fields are displayed by default: -- preview: card image -- review: rating information with the number of rating stars (out of five) and the number of reviews -- category: the subtitle of a card -- title: the title of a card which is a specialist's name -- subtitle: the subtitle of a card, for example, experience details -- price: the price of the service -- details: other details of a card +### Toggle default card fields + +The card's left side displays the following fields by default: + +- `preview` — card image +- `review` — rating information with the number of rating stars (out of five) and the number of reviews +- `category` — the category name (for example, a specialist's job) +- `title` — the card title (for example, a specialist's name) +- `subtitle` — the card subtitle (for example, experience details) +- `price` — the price of the service +- `details` — other details of a card -To hide any information block from cards' display, set the appropriate parameter value of the [`cardShape`](/api/config/booking-cardshape) property to **false**. +To hide a field, set the corresponding parameter of the [`cardShape`](/api/config/booking-cardshape) property to `false`. -Example: +The example below hides the `details` field of a card: ~~~jsx {24} const data = [ @@ -68,12 +72,16 @@ new booking.Booking("#root", { ~~~ :::info -Please, see an example in the [snippet tool](https://snippet.dhtmlx.com/6mxd7918) +See an example in the [snippet tool](https://snippet.dhtmlx.com/6mxd7918). ::: -To apply a template to each card (the left-hand block), use the [`cardTemplate`](/api/config/booking-cardtemplate) property. +### Apply a custom card template -First, create a function that takes a card object and returns a string of HTML. To define a template, arrange card item properties into any HTML blocks with custom styles. In the example, `cardPreviewTemplate` returns HTML for a card that includes a preview image (card.preview), category (card.category), title (card.title), and price (card.price). +The [`cardTemplate`](/api/config/booking-cardtemplate) property replaces the default left-hand block of a card with custom HTML. + +Create a function that takes a card object and returns an HTML string. Arrange card item properties into HTML blocks with custom styles. + +The following code snippet defines `cardPreviewTemplate`, which returns HTML for a card with a preview image, category, title, and price: ~~~html {} ~~~ -## Custom styles +## Apply custom styles + +To match your project design, scope the CSS variables under a custom class on the Booking container. -To customize the appearance of Booking to your project needs, you need to apply the corresponding CSS variables. +The following code snippet defines a custom palette for the `.demo` container: ~~~html
@@ -83,7 +96,7 @@ To customize the appearance of Booking to your project needs, you need to apply ~~~ -The next example shows how to change the background color for cards: +The following code snippet changes the background color of cards and the date items: ~~~html