Skip to main content

Reusable Django UI components and tags with Tailwind support

Project description

🌸 Beautypy

Beautypy is a Django UI component library that provides pre-designed, reusable template tags for building modern, responsive UIs with Bootstrap 5. Create beautiful interfaces in minutes—no HTML or CSS required!


✨ Features

  • ✅ Clean, responsive, accessible Bootstrap 5 components
  • ⚡ Lightning-fast integration with Django templates
  • 💡 Simple custom template tags: {% Button %}, {% Alert %}, {% Navbar %}, {% Tooltip %}, and more
  • ☕ Support development via Buy Me a Coffee

📦 Installation

pip install beautypy  # (Test version: see below)

Currently under testing phase. Install the test version with:

pip install -i https://test.pypi.org/simple/ beautypy

🎨 Bootstrap 5 Integration

Beautypy uses Bootstrap 5 for styling. You can include Bootstrap in your project via following this setup:

⚙️ Django Setup

  1. Add to INSTALLED_APPS
INSTALLED_APPS = [
    ...
    'beautypy',
]
  1. Templates Context Processor Make sure your TEMPLATES setting includes:
'OPTIONS': {
    'context_processors': [
        ...
        'django.template.context_processors.request',
    ],
}
  1. Load Beautypy Tags In your templates top of your html page:
{% load Components %}
  1. Load Bootstrap CSS/JS (if not already loaded globally)
{% LoadBeautypyCSS %}   {# Loads Bootstrap CSS #}
{% LoadBeautypyJS %}    {# Loads Bootstrap JS #}

🧩 Components & Template Tags

1. {% LoadBeautypyCSS %}

Loads Bootstrap CSS. Uses local static if available, otherwise falls back to CDN.

Usage:

{% LoadBeautypyCSS %}

2. {% LoadBeautypyJS %}

Loads Bootstrap JS. Uses local static if available, otherwise falls back to CDN.

Usage:

{% LoadBeautypyJS %}

3. {% Button %}

Renders a Bootstrap-styled button.

Props:

  • label (required): Button text
  • type: Button type (button, submit, etc.)
  • variant: Bootstrap color variant (primary, secondary, success, danger, warning, info)
  • css_class: Additional classes
  • tag_id: Optional id

Usage:

{% Button label="Submit" type="submit" variant="primary" %}

4. {% Link %}

Renders a Bootstrap-styled link (anchor).

Props:

  • url (required): Href
  • label (required): Link text
  • css_class: Additional classes (default: btn btn-link)
  • tag_id: Optional id

Usage:

{% Link url="/home" label="Home" css_class="btn btn-primary" %}

5. {% Alert %}

Renders a Bootstrap-styled alert box.

Props:

  • message (required): Alert text
  • alert_type: info, success, warning, error
  • css_class: Additional classes (default: alert)
  • tag_id: Optional id

Usage:

{% Alert message="Success!" alert_type="success" %}

6. {% InputField %}

Renders a Bootstrap input field.

Props:

  • name (required)
  • value: Default value
  • input_type: Input type (default: text)
  • css_class: Additional classes (default: form-control)
  • tag_id: Optional id

Usage:

{% InputField name="email" input_type="email" css_class="form-control" %}

7. {% InputLabel %}

Renders a Bootstrap label for an input.

Props:

  • name (required): For attribute
  • label_text (required): Label text
  • css_class: Additional classes (default: form-label)
  • tag_id: Optional id (default: label)

Usage:

{% InputLabel name="email" label_text="Your Email" %}

8. {% FormGroup %}

Groups a label and input together in a Bootstrap form group.

Props:

  • label (required): Label text
  • input_field (required): Input field (rendered separately)

Usage:

{% FormGroup label="email" input_field=input_field %}

9. {% Toast %}

Renders a Bootstrap-styled toast notification.

Props:

  • message (required)
  • toast_type: info, success, warning, error
  • tag_id: Optional id

Usage:

{% Toast message="Operation successful!" toast_type="success" %}

10. Block Tags

These tags wrap content in Bootstrap containers/sections/footers/navbars, etc.

Section

{% Section title="Section Title" css_class="mb-4" tag_id="section1" %}
  <!-- Content -->
{% endSection %}

Container

{% Container css_class="container my-4" tag_id="main-container" %}
  <!-- Content -->
{% endContainer %}

Footer

{% Footer css_class="text-center text-muted py-3" tag_id="footer" %}
  &copy; 2025 Beautypy
{% endFooter %}

Navbar

{% Navbar css_class="navbar navbar-expand-lg navbar-dark bg-primary p-4" tag_id="main-navbar" %}
  <!-- Logo / Nav links / Buttons -->
{% endNav %}

Tooltip

{% Tooltip title="Helpful info!" css_class="d-inline-block" %}
  <button class="btn btn-secondary">Hover me</button>
{% endTooltip %}

Accordion

{% Accordion title="Click to Expand" css_class="accordion" tag_id="accordion1" %}
  <p>This content is toggled.</p>
{% endAccordion %}

📷 Example Template

{% load Components %}
<!DOCTYPE html>
<html>
  <head>
    <title>Beautypy Example</title>
    {% LoadBeautypyCSS %}
  </head>
  <body>
    {% Navbar css_class="navbar navbar-expand-lg navbar-dark bg-primary p-4" %}
      <!-- Content -->
    {% endNav %}

    {% Section title="Alerts" %}
      {% Alert message="Success!" alert_type="success" %}
    {% endSection %}

    {% Footer css_class="text-center text-muted py-3" %}
      &copy; 2025 Beautypy
    {% endFooter %}

    {% LoadBeautypyJS %}
  </body>
</html>

🤝 Contributing

  1. Fork this repository
  2. Create your feature branch:
git checkout -b feature/my-component
  1. Commit your changes:
git commit -m 'Add my new component'
  1. Push to the branch:
git push origin feature/my-component
  1. Open a pull request

💖 Support

Beautypy is open-source. If you like the project, consider supporting it via Buy Me a Coffee.

🔗 License

MIT License © 2025 webdevavi96 | Avinash

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

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

Source Distribution

beautypy-1.0.tar.gz (2.1 MB view details)

Uploaded Source

Built Distribution

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

beautypy-1.0-py3-none-any.whl (2.4 MB view details)

Uploaded Python 3

File details

Details for the file beautypy-1.0.tar.gz.

File metadata

  • Download URL: beautypy-1.0.tar.gz
  • Upload date:
  • Size: 2.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for beautypy-1.0.tar.gz
Algorithm Hash digest
SHA256 e530e5633dfb481d26213ab8aa482f76784ccb29eda39545bf4c5420618b0b63
MD5 1086c83e2272d8d45b77f18d04c94f76
BLAKE2b-256 2ada67793881957aaf1af6b3d0987f1d8867cdfb4975ef5db2f654c065e57312

See more details on using hashes here.

File details

Details for the file beautypy-1.0-py3-none-any.whl.

File metadata

  • Download URL: beautypy-1.0-py3-none-any.whl
  • Upload date:
  • Size: 2.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for beautypy-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9b78a0497a3fcbfb0caf7af91cf6412482e36580c2891fda62ba9124cc3c23ec
MD5 e45224c17eb26b50a5e87c97cdeaaf48
BLAKE2b-256 e2a1832982b2c2821c3a6244fdfedcea6e2f82978d77a11f43257dff376dec9d

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