You just have to declare the attribute as a public property and pass the value in the constructor. il will be accessible in the class:
public $name;
public function __construct(string $name)
{
$this->name = $name;
}
If you use anonymous components, you can add a prop 'name' to isolate the attribute from the attributes bag and make any condition with the $name value
@props(['name'])
// conditions with $name value...
<input name="{{ $name }}" {{ $attributes }} ... />
Or you can create a dynamic component (with Laravel 8)
@props(['name'])
<x-dynamic-component :component="input.$name" {{ $attributes }} />