DivKit
DivKit is a library for building a user interface from a description that comes from the server. The backend sends the card layout as JSON, and the app renders it with the native tools of the platform: Android, iOS, web. To change a screen, you change the JSON on the server; no new app release is needed.
How DivKit works
- The server describes a card. A card is a JSON document: a tree of elements (text, image, container, gallery, and others) with their sizes, styling, and actions. Repeated parts are moved into templates.
- The app passes the JSON to DivKit. The SDK parses the document and builds a native interface from it.
- The user interacts with the card. Taps and other events trigger actions: they switch states, change variables, open links, or are passed to the app.
- The card changes without a restart. Variables, expressions, and timers update the content on the fly, and the server can load new markup.
Core concepts
- Card and elements: what the layout consists of and how elements are placed relative to each other. See Typical structure and Element groups.
- Templates: reusable element blueprints that make the JSON shorter. See Templates.
- Variables and expressions: values that the content and appearance of the card depend on. See Variables and Calculated expressions.
- Actions and states: how the card reacts to the user: switching states, animations, loading more data. See Actions with elements and Animation.
- Extensions: a way to add logic or an element that DivKit does not have. See Customization.
Where to start
- App developer: connect the SDK: Android, Jetpack Compose, iOS, Kotlin Multiplatform.
- Card author: build your first card in the DivKit Playground and learn about element location and size.
- Backend developer: generate JSON from code with the Kotlin DSL.
- Reference: the full description of elements and their properties, starting with the card root structure.
Learn more
You can discuss topics of interest in the DivKit user community in Telegram: https://t.me/divkit_community_en.