# clanbite_register_component()

Register a component: a piece of UI or behaviour (an avatar, reaction chips, an @mention picker) other extensions can use.

Call it on the action `clanbite_register_components`. A component has a `render` callback (returns HTML), an `enqueue` callback
(loads its scripts and styles) or both. Consumers never reach into the provider's classes: they ask the registry, so a missing
provider means a quiet fallback (`clanbite_render_component()` returns an empty string) and a replacement provider needs no change
in the consumers.

```php
add_action( 'clanbite_register_components', function () {
    clanbite_register_component( 'reaction-summary', array(
        'label'    => __( 'Reaction chips', 'my-plugin' ),
        'provider' => 'my_extension',
        'version'  => '1.0.0',
        'requires' => array( 'reactions' ),
        'render'   => fn( array $args ): string => my_render_chips( $args ),
    ) );
} );
```

```php
clanbite_register_component( string $slug, array $args ): bool
```

## Parameters

- `$slug` (string) Lowercase slug (`a-z0-9_-`), e.g. `avatar`, `reaction-picker`.
- `$args` (array<string, mixed>) Component definition.
  - `$label` (string) Readable name.
  - `$description` (string) What it is for.
  - `$provider` (string) Slug of the extension that provides it (`cp_social_kit`, `clanbite`…).
  - `$version` (string) Component version `x.y.z` (so consumers can tell what they are using).
  - `$render` (callable) `( array $args ): string` HTML for the arguments the caller passes. Optional.
  - `$enqueue` (callable) `(): void` loads the component's scripts and styles. Optional.
  - `$requires` (string[]) Slugs of components this one needs; it is unavailable while one is missing.
  - `$surfaces` (string[]) Where it is known to be shown (`feed`, `forums`…), documented for developers.
  - `$args` (array) Documentation of the arguments `render` accepts, `name => description`.
  - `$replace` (bool) True to replace a component another provider registered under the same slug.

## Return

`bool` True when registered; false for an invalid definition or a slug taken without `replace`.

## Changelog

| Version | Description |
| --- | --- |
| 1.6.3 | Introduced |
