FAQ

Tip

If you are looking for an answer to a specific question, use the keyboard shortcut Ctrl + F (or Cmd + F for macOS) to search the page.

General questions about DivKit

What is DivKit?

DivKit is a cross-platform library based on the Server-Driven UI approach. It lets you build the user interface of apps and websites using their layout description in JSON format.

What is a Server-Driven UI?

This a development concept used to generate the layout of web pages and apps on the server. Next, the layout description is sent to the client, where the UI is automatically rendered based on this description.

Using this concept, you can:

  • Change the appearance of your app and add new visual elements without releasing a new app version.
  • Use the same page layout on different platforms.
What platforms does DivKit support?

The client side of DivKit supports iOS, Android, and Web.

Can Server-Driven UI-based apps be published in the Apple and Google app stores?

The AppStore and Google Play rules do not prohibit updating the UI of apps based on data received from the server, provided that these updates do not change an app's original concept.

Can I use DivKit in a commercial app?

Yes. DivKit is an open-source library released under Apache License Version 2.0.

How fast does DivKit work?

In our experience, it takes less than 16 ms on average to render heavy web pages. DivKit runs in multithreaded mode and can reuse previously rendered elements. This lets you quickly estimate text elements (such as large volumes of text or tables) and speed up the interface in general.

Questions about software development using DivKit

Where is data taken from for cards?

A card description in JSON format can be stored on the server or locally on a device.

To generate card layout descriptions in JSON format, you can use the json-builder library that is available for Kotlin, TypeScript, and Python.

The pydivkit library contains components for generating JSON from Edadeal.

What should a card layout look like?

The layout of a card should be described in JSON format according to a particular scheme.

How do I test a custom layout quickly?

To prepare a JSON description of the layout and see a preview of the card in web format, you can use DivKit Web Playground. Next, you can transfer your JSON file to the DivKit Playground app for Android or iOS and see how the layout is displayed on a mobile device.

How do I implement interactive elements (click-throughs, actions, and clicks)?

DivKit supports actions that can be called when clicking on an element. Using actions, you can change the status of elements, upload additional data, or invoke event handlers that are implemented at the host application level.

DivKit also supports variables and triggers. A trigger is fired when the value of a variable changes and triggers one or more actions.

Can I change a layout based on dynamic data?

Yes. For example, using variables. If the value of a property is set via a variable, when the variable is changed, the view is rebuilt.

How is logic (such as actions performed when changing field values) handled?

The logic can be handled using variables, calculated expressions, and triggers. DivKit also contains a set of functions for working with strings, dates, and numbers.
For example, if a user enters text in a field, this value can be passed to a variable. Changing the variable value fires a trigger that triggers a certain action.

Is animation supported?

Yes, DivKit supports several types of animation: transitions when switching states, clicking on buttons, and displaying and hiding elements.

Can I use DivKit to design the layout of individual application screens?

Yes, you can. For example, in Yandex applications, DivKit cards are often integrated into one or more screens.

Can I implement a form for entering data?

Yes. To do this, use the div-input element designed for text input.

Is accessibility supported?

Yes. DivKit has elements that provide accessibility for disabled people.

Is localization supported?

Special localization mechanisms are not provided. To localize your interface elements, generate individual JSON layout files for each language.

How does the backend work?

We don't have a ready-made solution to deploy the server side with. DivKit contains libraries for generating JSON layout files that you can integrate into your server.

How do I implement light and dark themes?

Use variables. For example, you can get a palette from the server as a combination of two colors for each element. On the client side, you should set variables that indicate the colors to be used for elements.

How do I log cards properly?

For proper logging, make sure log_id is unique. For example, when logging cards in a carousel, each card must have its own log_id, otherwise only the first card will be logged, and all the others will be considered duplicates.

How do I disable action animation?

In animation, specify "name": "no_animation".

How do I create a card with Lottie animation?

To add a Lottie animation, set the extensions array in image. For more information, see Customization.

How do I create an empty block?

If you need a block that will just take up space, use separator and specify a transparent color for it in the color parameter.

How do I create containers with a single element?

It isn't worth it, it will affect performance. Try not to create unnecessary wrappers.

Learn more

Follow DivKit news in the Telegram channel: http://t.me/divkit_news

You can also discuss topics of interest in the DivKit user community in Telegram: https://t.me/divkit_community_ru

DivKit Repository