Links
The Link field type hydrates into WearePixel\Inlay\Support\LinkValue, a plain readonly value object with label, url, and openInNewTab:
use WearePixel\Inlay\Attributes\Link;
use WearePixel\Inlay\Support\LinkValue;
final class Hero extends Component implements InlayComponent
{
public function __construct(
#[Link(label: 'Call to action')]
public ?LinkValue $cta = null,
) {}
}
@if ($cta)
<a href="{{ $cta->url }}" @if ($cta->openInNewTab) target="_blank" @endif>{{ $cta->label }}</a>
@endif
URL scheme safety
Only http://, https://, mailto:, and relative (scheme-less) URLs are ever persisted. Anything else - javascript:..., for example - is rejected before it reaches storage, at the point an editor saves it. You can render $cta->url directly into an href attribute without adding your own scheme check.