diff --git a/packages/forms/resources/views/components/text-input.blade.php b/packages/forms/resources/views/components/text-input.blade.php index 2434a927cb..d7aa263494 100644 --- a/packages/forms/resources/views/components/text-input.blade.php +++ b/packages/forms/resources/views/components/text-input.blade.php @@ -28,5 +28,11 @@ class="block w-full rounded-r placeholder-gray-400 focus:placeholder-gray-500 placeholder-opacity-100 focus:border-blue-300 focus:ring focus:ring-blue-200 focus:ring-opacity-50 {{ ! $formComponent->getPrefix() ? 'rounded-l-md' : null }} {{ $errors->has($formComponent->getName()) ? 'border-danger-600 motion-safe:animate-shake' : 'border-gray-300' }}" {!! Filament\format_attributes($formComponent->getExtraAttributes()) !!} /> + + @if ($formComponent->getPostfix()) + + {!! $formComponent->getPostfix() !!} + + @endif diff --git a/packages/forms/src/Components/Concerns/HasPostfix.php b/packages/forms/src/Components/Concerns/HasPostfix.php new file mode 100644 index 0000000000..f3842c613d --- /dev/null +++ b/packages/forms/src/Components/Concerns/HasPostfix.php @@ -0,0 +1,22 @@ +postfix; + } + + public function postfix($postfix) + { + $this->configure(function () use ($postfix) { + $this->postfix = $postfix; + }); + + return $this; + } +} diff --git a/packages/forms/src/Components/TextInput.php b/packages/forms/src/Components/TextInput.php index 4d259d7fb6..3580ba92db 100644 --- a/packages/forms/src/Components/TextInput.php +++ b/packages/forms/src/Components/TextInput.php @@ -11,6 +11,7 @@ class TextInput extends Field use Concerns\CanBeLengthConstrained; use Concerns\HasPlaceholder; use Concerns\HasPrefix; + use Concerns\HasPostfix; protected $type = 'text';