Skip to main content

A reusable UI component library built on pydivkit

Project description

Smarty UI

A UI components framework for building DivKit widgets for Smarty, aligned with the Smartbank Figma design system.

Overview

Smarty UI provides a layered component architecture built on top of pydivkit:

  • Tokens - Design system values (colors, typography, spacing)
  • Primitives - Basic UI atoms (text, buttons, images, dividers)
  • Composites - Reusable molecules (badges, input fields, status bubbles)
  • Blocks - Complete UI patterns (cards, lists, widgets)

Installation

pip install -e .

Quick Start

import pydivkit as dk
from smart_ui import (
    # Layout helpers
    HStack, VStack,
    # Primitives
    title_1, text_1, primary_button, smarty_button,
    # Blocks
    transaction_success_widget, payment_status_widget,
    home_balance_widget,
    # Theme
    default_theme,
)

# Create a simple card
card = VStack(
    [
        title_1("Hello, Smarty!"),
        text_1("Welcome to the UI framework."),
        primary_button("Get Started", action_url="div-action://start"),
    ],
    gap=12,
    padding=16,
    background="#FFFFFF",
    corner_radius=12,
)

# Create a transaction status widget
widget = transaction_success_widget(
    amount="200 000",
    recipient="ALEKSANDR GURYANOV ** 2221",
    date_time="3 сентября 2023 18:27",
)

Components

Layout Helpers

# Horizontal stack (row)
HStack([item1, item2, item3], gap=8, align_v="center")

# Vertical stack (column)  
VStack([header, content, footer], gap=12, align_h="left", padding=16)

Primitives

Component Description
title_1, title_2 Heading text styles
text_1, text_2, text_3 Body text styles
caption_1, caption_2, caption_3 Small text styles
primary_button, secondary_button Button variants
outline_button, smarty_button Outline button styles
icon, avatar, cover_image Image components
divider, h_spacer, v_spacer Layout utilities

Composites

Component Description
status_bubble Transaction/payment status display
chat_bubble Chat message bubbles
badge, outline_badge Label badges
icon_label Icon + text pair
input_field Text input field
card_balance_item Card balance row

Blocks

Component Description
transaction_success_widget Successful transfer status
transaction_failed_widget Failed transfer status
transaction_pending_widget Pending transfer status
payment_success_widget Successful payment status
payment_failed_widget Failed payment status
payment_pending_widget Pending payment status
home_balance_widget Utility balances widget
balance_widget Card/account balances
bank_card Bank card display
service_list Service categories list
contacts_list Contact list

Theming

from smart_ui import default_theme, dark_theme, Theme, ColorTokens

# Use default Smartbank theme
widget = balance_widget(total_balance="1 000 000", theme=default_theme)

# Use dark theme
widget = balance_widget(total_balance="1 000 000", theme=dark_theme)

# Create custom theme
custom_theme = Theme(
    colors=ColorTokens(
        primary="#FF5722",
        background="#FAFAFA",
    )
)

Project Structure

src/smart_ui/
├── tokens/           # Design tokens
│   ├── colors.py     # Color palette
│   ├── typography.py # Font styles
│   └── spacing.py    # Spacing scale
├── primitives/       # Basic UI atoms
│   ├── text.py       # Text components
│   ├── button.py     # Button variants
│   ├── image.py      # Image components
│   └── smarty_button.py
├── composites/       # Reusable molecules
│   ├── status_bubble.py
│   ├── chat_bubble.py
│   └── ...
├── blocks/           # Complete UI patterns
│   ├── transaction_status_widget.py
│   ├── payment_status_widget.py
│   ├── home_balance_widget.py
│   └── ...
└── _helpers.py       # Layout utilities (HStack, VStack)

License

Internal use only.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

smarty_ui-0.1.2.tar.gz (100.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

smarty_ui-0.1.2-py3-none-any.whl (162.1 kB view details)

Uploaded Python 3

File details

Details for the file smarty_ui-0.1.2.tar.gz.

File metadata

  • Download URL: smarty_ui-0.1.2.tar.gz
  • Upload date:
  • Size: 100.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.13.3 Linux/6.12.9-200.fc41.x86_64

File hashes

Hashes for smarty_ui-0.1.2.tar.gz
Algorithm Hash digest
SHA256 09297539ee553a8716df860666b19afc8013dbd6770da5ea1fc6797516a6fb44
MD5 f21dc7b064a5d3b0a0ac89c31d0d732a
BLAKE2b-256 625ee3cbcd987febdf9592aa19a31c0c0b571221c6bae56c4210f9d1811dd5cd

See more details on using hashes here.

File details

Details for the file smarty_ui-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: smarty_ui-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 162.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.13.3 Linux/6.12.9-200.fc41.x86_64

File hashes

Hashes for smarty_ui-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0deb03c916b76ce3b6d9497b1a057796282b145b0a3606c60d08818b99d3fbf8
MD5 2c66d3152cef2c7534beb7010a74d157
BLAKE2b-256 3387f46fc575c1b6c46083bb9134bf4b051bd946b2188a0ea2a3a3832078bc71

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page