# [Usage](../../../usage.md) > [Components and standard attributes](../basics.md) > setAttribute()

---
Is possible to set attributes in two ways, using the `->setAttribute()` method:

```php
Component::make()
    ->setAttrbute('attribute_name', $value)
```

or using the _SET_ functions, and each attribute has one, following camelcase:

```php
Component::make()
    ->setAttribute1($value1)
    ->setAttribute2($value2)
    ...
    ->setAttributeN($valueN)
```

An attribute, can also handle callbacks:

```php
Component::make()
    ->setLabel(function () {
        return 'label for component';
    })
```
Callbacks, depending on the type of component or the parent component (example, a Form), can also receive callable variables:
```php
Component::make()
    ->setAttributeName(function ($component, $record, $fields, ...) {
        //
    })
```

Generic fallback setter: `setAttribute('name', $value)` works for any property, typed `setX()` is preferred for readability. Applies to Form fields, Visuals, and containers. When omitted nothing is set; attributes are always optional.
Third arg `$copy=true` also stores the value in `attributesCopy` for cloning.

### Example
Blade:
```php
{!! \KFramework\Components\Forms\Input::make()->setAttribute('label', 'E-mail') !!}
```
Controller:
```php
Input::make('email')->setAttribute('label', 'E-mail')->setAttribute('required', true);
```

### Interaction / tips
- Prefer typed setters (`setLabel`, `setName`); use `setAttribute` for dynamic keys (see `make` (../shared_attributes/make.md)).
- Values accept Closures resolved with `($component, $record, $fields)` context.
- Custom keys go via `setCustomProperty` (../shared_attributes/custom_property.md), not `setAttribute`.

See also: [make](make.md), [customProperty](custom_property.md), [label](label.md), [name](name.md), [basics](../basics.md), [Input](../forms/input.md).