Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

bricks-elements

БесплатноБез исполняемых скриптовНе проверен

Create custom elements for Bricks Builder extending the Element class.

wpgauravот wpgaurav★ 24 звезды на GitHub

Об этом скилле

Bricks Elements Skill

This skill covers creating custom elements for Bricks Builder.

Element Architecture

All elements extend the abstract \Bricks\Element class and live in includes/elements/.

Element Class Structure

<?php
namespace Bricks;

if ( ! defined( 'ABSPATH' ) ) exit;

class Element_My_Custom extends Element {
    // Required properties
    public $category = 'general';     // Element category in panel
    public $name     = 'my-custom';   // Unique element identifier
    public $icon     = 'ti-star';     // Themify icon class

    // Optional properties
    public $tag          = 'div';         // Default HTML tag
    public $scripts      = [];            // JS dependencies
    public $css_selector = '';            // Default CSS selector for controls
    public $draggable    = true;          // Allow dragging in builder
    public $deprecated   = false;         // Hide from panel if true
    public $nestable     = false;         // Allow child elements

    public function get_label() {
        return esc_html__( 'My Custom Element', 'bricks' );
    }

    public function get_keywords() {
        return [ 'custom', 'my', 'element' ];
    }

    public function set_control_groups() {
        // Define control groups
    }

    public function set_controls() {
        // Define controls
    }

    public function render() {
        // Frontend output
    }

    public static function render_builder() {
        // Builder preview (Vue template)
    }
}

Registering Custom Elements

Method 1: Filter Hook (Recommended)

add_filter( 'bricks/builder/elements', function( $element_names ) {
    $element_names[] = 'my-custom';
    return $element_names;
} );

// Load element class
add_action( 'init', function() {
    require_once 'path/to/element-my-custom.php';
}, 11 );

Method 2: Element Class Registration

add_action( 'init', function() {
    \Bricks\Elements::register_element( 'path/to/element-my-custom.php' );
}, 11 );

Element Categories

Built-in categories:

  • basic - Basic elements (heading, text, button, image, video)
  • general - General elements (divider, icon-box, accordion, tabs, form, etc.)
  • media - Media elements (image-gallery, audio, carousel, slider)
  • wordpress - WordPress elements (posts, terms, navigation)
  • single - Single post elements (post-title, post-content, post-meta)
  • woocommerce - WooCommerce elements (if active)

Custom Category

add_filter( 'bricks/builder/element_categories', function( $categories ) {
    $categories['my-category'] = [
        'title' => 'My Custom',
        'icon'  => 'ti-package',
    ];
    return $categories;
} );

Control Types

Basic Controls

public function set_controls() {
    // Text input
    $this->controls['title'] = [
        'tab'         => 'content',
        'label'       => esc_html__( 'Title', 'bricks' ),
        'type'        => 'text',
        'default'     => 'Hello World',
        'placeholder' => 'Enter title...',
    ];

    // Textarea
    $this->controls['description'] = [
        'tab'   => 'content',
        'label' => esc_html__( 'Description', 'bricks' ),
        'type'  => 'textarea',
    ];

    // Number
    $this->controls['count'] = [
        'tab'         => 'content',
        'label'       => esc_html__( 'Count', 'bricks' ),
        'type'        => 'number',
        'min'         => 1,
        'max'         => 100,
        'step'        => 1,
        'default'     => 5,
        'placeholder' => 5,
    ];

    // Number with units (for CSS)
    $this->controls['spacing'] = [
        'tab'   => 'content',
        'label' => esc_html__( 'Spacing', 'bricks' ),
        'type'  => 'number',
        'units' => true, // Enables px, %, em, rem, vw, vh
        'css'   => [
            [
                'property' => 'margin-bottom',
                'selector' => '.item',
            ],
        ],
    ];

    // Checkbox
    $this->controls['showIcon'] = [
        'tab'   => 'content',
        'label' => esc_html__( 'Show icon', 'bricks' ),
        'type'  => 'checkbox',
    ];

    // Select dropdown
    $this->controls['layout'] = [
        'tab'         => 'content',
        'label'       => esc_html__( 'Layout', 'bricks' ),
        'type'        => 'select',
        'options'     => [
            'grid'    => esc_html__( 'Grid', 'bricks' ),
            'list'    => esc_html__( 'List', 'bricks' ),
            'masonry' => 'Masonry',
        ],
        'inline'      => true,
        'placeholder' => esc_html__( 'Grid', 'bricks' ),
    ];

    // Color picker
    $this->controls['primaryColor'] = [
        'tab'   => 'content',
        'label' => esc_html__( 'Primary color', 'bricks' ),
        'type'  => 'color',
        'css'   => [
            [
                'property' => 'color',
                'selector' => '.title',
            ],
        ],
    ];
}

Media Controls

// Image
$this->controls['image'
Полный SKILL.md на GitHub

Установить bricks-elements в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл bricks-elements?

Create custom elements for Bricks Builder extending the Element class.

Как установить скилл bricks-elements?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл bricks-elements запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить bricks-elements с