### Vue 3 Core Store Setup (core/store.js)
Source: https://context7.com/andrushin-anton/bx-components/llms.txt
Sets up the central Vuex store for the application, defining modules for users and tasks. It requires the 'ui.vue3.vuex' library for store creation. This store manages application state and provides a centralized place for state management.
```javascript
// Core Store Setup (core/store.js)
import { createStore } from 'ui.vue3.vuex';
export const Store = createStore({
modules: {
users: usersModule,
tasks: tasksModule
}
});
```
--------------------------------
### Icon API Usage Example
Source: https://context7.com/andrushin-anton/bx-components/llms.txt
Demonstrates how to use the Icon API to render standardized icons with various configurations, including basic icons, custom sizes and colors, hover effects, social icons, and responsive icons. It requires importing from 'ui.icon-set.api.core'.
```javascript
import { Icon, Actions, Social, Main, IconHoverMode } from 'ui.icon-set.api.core';
// Create basic icon
const editIcon = new Icon({
icon: Actions.PENCIL_DRAW
}).render();
document.getElementById('edit-button').appendChild(editIcon);
// Icon with custom size and color
const settingsIcon = new Icon({
icon: Actions.SETTINGS_1,
size: 32,
color: '#2C3E50'
}).render();
document.getElementById('settings-button').appendChild(settingsIcon);
// Icon with hover effect
const deleteIcon = new Icon({
icon: Actions.DELETE,
size: 24,
color: '#E74C3C',
hoverMode: IconHoverMode.ALT
}).render();
document.getElementById('delete-button').appendChild(deleteIcon);
// Social icons
const facebookIcon = new Icon({
icon: Social.FACEBOOK,
size: 20
}).render();
const twitterIcon = new Icon({
icon: Social.TWITTER,
size: 20
}).render();
// Responsive icon
const responsiveIcon = new Icon({
icon: Main.MENU,
responsive: true
}).render();
document.getElementById('social-links').append(facebookIcon, twitterIcon);
```
--------------------------------
### Vue 3 Input and Chip Components Example
Source: https://context7.com/andrushin-anton/bx-components/llms.txt
Demonstrates the usage of Input and Chip components in Vue 3, showcasing different sizes, designs, and states. It includes form fields for email and password, a search input, and interactive category chips. Dependencies include 'ui.system.input.vue' and 'ui.system.chip.vue'.
```vue
{{ emailError }}
Selected Categories:
```
--------------------------------
### Vue 3 Button Component Examples
Source: https://context7.com/andrushin-anton/bx-components/llms.txt
This Vue 3 component demonstrates various configurations of the Button component. It shows how to use props for text, icons, loading states, counters, dropdown indicators, and custom styling for button groups. It imports necessary components and enums from the 'ui.vue3.components.button' module.
```vue
```
--------------------------------
### PHP Integration for Vue App (template.php)
Source: https://context7.com/andrushin-anton/bx-components/llms.txt
Example of how to integrate the Vue 3 User Manager application into a PHP template. It loads the necessary extension and uses JavaScript to create and mount the Vue application within a specified HTML container. It also demonstrates passing options to the Vue app via JSON encoding.
```php
// PHP Integration (template.php)
// Extension::load('myapp.application.user-manager');
//
//
```
--------------------------------
### BMenu Component Usage with Options - Vue/JavaScript
Source: https://github.com/andrushin-anton/bx-components/blob/main/ui/system-menu-vue.md
Complete example of BMenu component implementation in a Vue component. Demonstrates menu configuration with bindElement, items array, click handlers, delimiters, and links. Shows v-if directive for visibility control and close event handling to toggle menu state.
```javascript
import { BMenu } from 'ui.system.menu.vue';
import type { MenuOptions } from 'ui.system.menu';
export const MyComponentWithMenu = {
name: 'MyComponentWithMenu',
components: {
BMenu,
},
data()
{
return {
isMenuShown: false,
};
},
computed: {
menuOptions(): MenuOptions
{
return {
bindElement: this.$refs.myButton,
items: [
{
title: 'Пункт 1',
onClick: () => console.log('Нажат пункт 1'),
},
{
title: 'Пункт 2',
onClick: () => console.log('Нажат пункт 2'),
},
{
delimiter: true,
},
{
title: 'Ссылка на сайт',
href: 'https://bitrix24.ru',
target: '_blank',
},
],
};
},
},
template: `
`,
};
```
--------------------------------
### Create Bitrix Extension with CLI
Source: https://context7.com/andrushin-anton/bx-components/llms.txt
Demonstrates creating a new Bitrix extension using the command-line interface. This process sets up the necessary file structure for the extension.
```shell
cd local/js/mymodule
bitrix create myextension
```
--------------------------------
### Add Informational Tooltips Programmatically (JavaScript)
Source: https://context7.com/andrushin-anton/bx-components/llms.txt
Illustrates programmatic usage of the `BX.UI.Hint` class for initializing hints, creating hint nodes, showing hints on demand, hiding active hints, and creating custom hint instances with specific configurations. This requires the `BX` object and its UI components to be available.
```javascript
// Programmatic usage
BX.UI.Hint.init();
// Initialize hints in specific container
const container = document.getElementById('dynamic-content');
BX.UI.Hint.init(container);
// Create hint node
const hintNode = BX.UI.Hint.createNode('This field is required');
document.getElementById('email-field').appendChild(hintNode);
// Show hint programmatically
const targetElement = document.getElementById('status-icon');
BX.UI.Hint.show(targetElement, 'Status: Active Last update: 2 hours ago', false);
// Hide active hint
BX.UI.Hint.hide();
// Custom hint instance
const customHints = BX.UI.Hint.createInstance({
attributeName: 'data-custom-hint',
className: 'my-custom-hint-class'
});
customHints.init();
```
--------------------------------
### Configure and Load Bitrix Extension (JavaScript, PHP)
Source: https://context7.com/andrushin-anton/bx-components/llms.txt
Illustrates how to configure a Bitrix extension using `bundle.config.js` and load it in both PHP and JavaScript. It outlines the process of importing and using components within a JavaScript application.
```javascript
// bundle.config.js
module.exports = {
input: './src/index.js',
output: './dist/bundle.js',
namespace: 'BX.MyApp',
browserslist: true,
protected: false
};
// Use in JavaScript
import { MyComponent } from 'mymodule.myextension';
const component = new MyComponent({
target: document.getElementById('app'),
props: { userId: 123 }
});
```
```php
// Load extension in PHP
// \Bitrix\Main\UI\Extension::load('mymodule.myextension');
```
--------------------------------
### Send System Notifications with Buttons and Reply Fields (JavaScript)
Source: https://context7.com/andrushin-anton/bx-components/llms.txt
Demonstrates how to use the `Notifier` class from `ui.notification-manager` to send simple notifications, notifications with action buttons, and notifications with a reply field. It also shows how to subscribe to click and reply events to handle user interactions. Requires the `ui.notification-manager` module.
```javascript
import { Notifier } from 'ui.notification-manager';
// Simple notification
Notifier.notify({
id: 'task-assigned-456',
category: 'tasks',
title: 'New Task Assigned',
text: 'You have been assigned to "Implement API integration"',
icon: '/upload/tasks/icon.png'
});
// Notification with action buttons
const notificationId = 'meeting-reminder-789';
Notifier.notify({
id: notificationId,
category: 'calendar',
title: 'Meeting in 10 minutes',
text: 'Daily standup with development team',
button1Text: 'Join Now',
button2Text: 'Snooze'
});
Notifier.subscribe('click', (event) => {
const { id, buttonId } = event.getData();
if (id === notificationId) {
if (buttonId === 1) {
window.open('/video-call/room/123', '_blank');
} else if (buttonId === 2) {
setTimeout(() => {
Notifier.notify({
id: notificationId + '-snooze',
title: 'Meeting starting now',
text: 'Daily standup with development team'
});
}, 300000); // 5 minutes
}
}
});
// Notification with reply field
Notifier.notify({
id: 'message-234',
category: 'im',
title: 'Sarah Johnson',
text: 'Can you review the latest pull request?',
inputPlaceholderText: 'Type your reply...'
});
Notifier.subscribe('reply', (event) => {
const { id, reply } = event.getData();
if (id === 'message-234') {
fetch('/api/messages/send', {
method: 'POST',
body: JSON.stringify({ chatId: 234, text: reply })
});
}
});
```
--------------------------------
### Bitrix CLI Build Commands
Source: https://context7.com/andrushin-anton/bx-components/llms.txt
Provides essential commands for the Bitrix CLI build system. This includes building all extensions, building with watch mode for hot-reloading, targeting specific modules or extensions, building from a specific path, running tests, and configuring watch mode with custom file extensions.
```bash
# Build all extensions
bitrix build
# Build with watch mode (hot-reload)
bitrix build --watch
# Build specific modules
bitrix build --modules main,ui,landing
# Build specific extensions
bitrix build --extensions main.core,ui.buttons,landing.main
# Build from specific path
bitrix build --path "./main/install/js/main/loader"
# Build with tests
bitrix build --test
# Watch with custom file extensions
bitrix build --watch=defaults,json,mjs,svg
# Run tests only
bitrix test
# Run tests with watch mode
bitrix test --watch
# Test specific modules
bitrix test --modules main,ui
# Test specific extensions
bitrix test --extensions ui.entity-selector,ui.system.menu
```
--------------------------------
### Create and Manage Popup Windows in JavaScript
Source: https://context7.com/andrushin-anton/bx-components/llms.txt
Initialize customizable popup windows with animations, overlays, flexible positioning, and event handlers. The Popup class supports title bars, close buttons, overlay configuration, button actions, and lifecycle events. Popups can be created, shown, retrieved by ID, and closed programmatically using the PopupManager utility.
```javascript
import { Popup, PopupManager } from 'main.popup';
const popup = new Popup({
id: 'my-popup',
content: '
User Profile
John Doe
john@example.com
',
titleBar: 'User Information',
width: 400,
closeIcon: true,
closeByEsc: true,
autoHide: true,
overlay: {
backgroundColor: '#000',
opacity: 0.5
},
animation: 'fading-slide',
buttons: [
new BX.UI.Button({
text: 'Edit Profile',
color: BX.UI.Button.Color.PRIMARY,
onclick: () => {
console.log('Edit clicked');
popup.close();
}
})
],
events: {
onShow: () => console.log('Popup opened'),
onClose: () => console.log('Popup closed'),
onDestroy: () => console.log('Popup destroyed')
}
});
popup.show();
// Get existing popup by ID
const existingPopup = PopupManager.getPopupById('my-popup');
if (existingPopup) {
existingPopup.close();
}
```
--------------------------------
### Vue 3 Application Entry Point (application/user-manager/src/app.js)
Source: https://context7.com/andrushin-anton/bx-components/llms.txt
The main entry point for the User Manager application. It uses 'ui.vue3.BitrixVue' to create and mount the Vue application, registering the 'UserList' component and the Vuex store. It depends on 'ui.vue3.BitrixVue', 'component/user-list', and 'core/store'.
```javascript
// Application Entry: application/user-manager/src/app.js
import { BitrixVue } from 'ui.vue3';
import { UserList } from './component/user-list';
import { Store } from './core/store';
export class UserManager {
static create(container, options = {}) {
const app = BitrixVue.createApp({
components: { UserList },
template: ''
});
app.use(Store);
app.mount(container);
return app;
}
}
```
--------------------------------
### Add Informational Tooltips Declaratively (HTML)
Source: https://context7.com/andrushin-anton/bx-components/llms.txt
Shows how to use data attributes in HTML to declaratively add hint tooltips to elements. Supports simple text, rich HTML content, interactivity, and disabling the default icon. No JavaScript dependencies are required for this usage.
```html
```
--------------------------------
### Popup Component API
Source: https://context7.com/andrushin-anton/bx-components/llms.txt
This section details the usage of the Popup component for creating and managing customizable popup windows. It includes options for content, title bar, size, behavior, and event handling.
```APIDOC
## Popup Component
### Description
Create and manage customizable popup windows with animations, overlays, and flexible positioning. The Popup component allows for rich content, a title bar, close icons, and various behavioral options like auto-hiding and closing by escape key.
### Method
`new Popup(options)`
### Parameters
#### Options (Object)
- **id** (string) - Optional - A unique identifier for the popup.
- **content** (string | HTMLElement) - Required - The HTML content or DOM element to display inside the popup.
- **titleBar** (string) - Optional - The text to display in the popup's title bar.
- **width** (number) - Optional - The width of the popup in pixels.
- **closeIcon** (boolean) - Optional - Whether to display a close icon in the title bar. Defaults to `false`.
- **closeByEsc** (boolean) - Optional - Whether to close the popup when the Escape key is pressed. Defaults to `false`.
- **autoHide** (boolean) - Optional - Whether to automatically hide the popup when clicking outside of it. Defaults to `false`.
- **overlay** (object) - Optional - Configuration for the overlay behind the popup.
- **backgroundColor** (string) - The background color of the overlay.
- **opacity** (number) - The opacity of the overlay.
- **animation** (string) - Optional - The type of animation to use for showing/hiding the popup (e.g., 'fading-slide').
- **buttons** (Array) - Optional - An array of BX.UI.Button objects to display at the bottom of the popup.
- **events** (object) - Optional - An object containing event handlers.
- **onShow** (function) - Callback function when the popup is shown.
- **onClose** (function) - Callback function when the popup is closed.
- **onDestroy** (function) - Callback function when the popup is destroyed.
### Methods
- **`show()`**: Displays the popup.
- **`close()`**: Closes the popup.
- **`destroy()`**: Removes the popup from the DOM.
### Static Methods
- **`PopupManager.getPopupById(id)`**: Retrieves an existing popup instance by its ID.
### Request Example
```javascript
import { Popup, PopupManager } from 'main.popup';
const popup = new Popup({
id: 'my-popup',
content: '
User Profile
John Doe
john@example.com
',
titleBar: 'User Information',
width: 400,
closeIcon: true,
closeByEsc: true,
autoHide: true,
overlay: {
backgroundColor: '#000',
opacity: 0.5
},
animation: 'fading-slide',
buttons: [
new BX.UI.Button({
text: 'Edit Profile',
color: BX.UI.Button.Color.PRIMARY,
onclick: () => {
console.log('Edit clicked');
popup.close();
}
})
],
events: {
onShow: () => console.log('Popup opened'),
onClose: () => console.log('Popup closed'),
onDestroy: () => console.log('Popup destroyed')
}
});
popup.show();
// Get existing popup by ID
const existingPopup = PopupManager.getPopupById('my-popup');
if (existingPopup) {
existingPopup.close();
}
```
### Response
This component primarily interacts with the DOM and does not return explicit data in a typical API response. Success is indicated by the visual rendering and behavior of the popup. Errors might be logged to the console.
#### Success Response
N/A
#### Response Example
N/A
```
--------------------------------
### Menu Component API
Source: https://context7.com/andrushin-anton/bx-components/llms.txt
This section explains how to use the Menu component to create context menus with various features like sections, icons, counters, and nested submenus.
```APIDOC
## Menu Component
### Description
Build context menus with sections, icons, counters, and nested submenus. The Menu component is highly customizable, allowing for rich interfaces for user actions.
### Method
`new Menu(options)`
### Parameters
#### Options (Object)
- **bindElement** (HTMLElement | string) - Required - The element to which the menu will be bound.
- **sections** (Array