bricks_create_class_category
Overview
Creates a new category for organizing global classes in the Bricks builder UI sidebar. Categories group related classes together (e.g., « Buttons », « Typography », « Cards »), making them easier to browse and apply.
Note that bricks_create_global_class can auto-create categories when a non-existent category name is specified. This tool is useful when you want to pre-create categories before adding classes, or when you need the category ID for other operations.
Key Features
When to Use
When you need the category ID for filtering or other operations
When organizing a large class library into logical groups
When NOT to Use
When a category with the same name already exists — check with bricks_get_class_categories first
Parameters
namestringREQUIREDCode Examples
Create a category for button classes
Creates a "Buttons" category that will group btn-primary, btn-secondary, btn-ghost, etc. in the builder sidebar.
// Create category for button classes
bricks_create_class_category({
name: "Buttons"
}){
"id": "f1a2b3",
"name": "Buttons",
"message": "Class category 'Buttons' created successfully."
}Common Mistakes
// Unnecessary manual category creation
bricks_create_class_category({ name: "Typography" })
bricks_create_class_category({ name: "Buttons" })
bricks_create_class_category({ name: "Cards" })
// Then create classes...// Categories auto-created from class batch
bricks_create_classes_batch({
classes: [
{ name: "text-sm", category: "Typography", settings: { ... } },
{ name: "btn-primary", category: "Buttons", settings: { ... } },
{ name: "card", category: "Cards", settings: { ... } }
]
})
// All 3 categories created automatically!Tips & Warnings
Tip: You rarely need to call this tool directly. The bricks_create_global_class and bricks_create_classes_batch tools auto-create categories when a non-existent category name is specified.
Recommended categories: Layout, Typography, Buttons, Cards, Utilities. For larger projects, also consider: Spacing, Forms, Components, Navigation, Footer.