Nighty Docs
  • About Nighty
  • Getting Started
    • First Launch
    • Usage Guide
  • Custom Scripts
    • Scripting Reference
  • 🛠️Troubleshooting
    • The application did not respond / Unknown Integration
    • Common solutions to all issues
    • Unable to launch
    • App is just a white box, UI not appearing / looking weird
    • Retrieving License Key
    • Flagged key
    • Rich Presence doesn't show up
  • UI SCRIPTING
    • API Reference
      • Tab
      • CardContainer
      • Card
      • Group
      • UI Elements
        • Text
        • Button
        • Input
        • Image
        • Toggle
        • Select
        • Checkbox
        • Table
Powered by GitBook
On this page
  • class CardContainer
  • Examples

Was this helpful?

  1. UI SCRIPTING
  2. API Reference

CardContainer

The CardContainer class is used to group single or multiple Card elements. Each container can either be of type columns or rows, which determines the layout of the cards.

PreviousTabNextCard

Last updated 4 months ago

Was this helpful?

class CardContainer

Do not create CardContainer instances directly. Instead, use the create_container() method of the class to genereate them.

At least one CardContainer is required within a Tab element.

A Tab can hold multiple CardContainer objects. Nesting CardContainer objects inside each other is allowed, meaning you can create complex layouts with nested containers. However, we do not recommend nesting more than 3 CardContainer objects, as it may result in a poorly structured UI that looks disorganized or cluttered.

Constructor

# Basic example
container = tab.create_container() # Default type of "columns" and variants of {"height": "full","width": "full"} will be used

# Custom parameters
container = tab.create_container(
    type="columns",
    height="full",
    width="auto",
    gap=8
)

# Rows example
container = tab.create_container(
    type="rows",
    height="full",
    width="auto",
    gap=8
)

Parameter
Description

type

Allowed: "columns" | "rows" Default: "columns"

width

Allowed: "auto" | "full" Default: "full"

height

Allowed: "auto" | "full" Default: "full"

gap

Methods

Method
Description

create_container(type, **kwargs)

Creates a nested CardContainer.

create_card(**kwargs)

Examples

tab = Tab(name='My Custom Tab')

# this container holds only one card, type does not matter
container = tab.create_container(type="columns")
card = container.create_card()

tab.render()


tab = Tab(name='My Custom Tab')

container = tab.create_container(type="columns")

left_card = container.create_card()
right_card = container.create_card()

tab.render()


tab = Tab(name='My Custom Tab')

top_container = tab.create_container(type="columns")

top_left_card = top_container.create_card()
top_right_card = top_container.create_card()

# this container holds only one card, type does not matter
bottom_container = tab.create_container(type="columns") 

bottom_card = bottom_container.create_card()


tab.render()

tab = Tab(name='My Custom Tab')

top_container = tab.create_container(type="columns")

top_left_card = top_container.create_card()
top_right_card = top_container.create_card()

bottom_container = tab.create_container(type="columns")

bottom_left_card = bottom_container.create_card()
bottom_right_card = bottom_container.create_card()


tab.render()


tab = Tab(name='My Custom Tab')

wrapper_container = tab.create_container(type="columns")

left_container = wrapper_container.create_container(type="rows")
top_card = left_container.create_card()
bottom_card = left_container.create_card()

# this container holds only one card, type does not matter
right_container = wrapper_container.create_container(type="columns")
right_card = right_container.create_card()

tab.render()

See Default: 6

Creates and adds the to the CardContainer.

The following examples demonstrate how to create layouts using CardContainers and .

Tab
Cards
Card
Gap
Simple example with just one card