Skip to content

Initials on profile vs avatar #1737

Open
@mattcode72

Description

@mattcode72

Flux version

2.2.1

Livewire version

3

Tailwind version

4.1.10

Browser and Operating System

Chrome on macOS

What is the problem?

Initials on profile component is not managed in the same way as avatar component. For my name "Matteo", with avatar initials I get "Ma" and for profile I get "M".

Code snippets

<flux:profile
                        avatar:name="{{ auth()->user()->name }}"
                        :name="auth()->user()->name"
                        avatar:color="auto"
                        icon-trailing="chevrons-up-down"
 />

How do you expect it to work?

I want the props :name="auth()->user()->name" to give me two letters for a single name (Matteo for example) and not only one.

The code to change is :

// If no initials are provided, we'll try to generate them from the name by taking the first letter of the first and last name... $initials ??= collect(explode(' ', $name ?? '')) ->map(fn($part) => Str::substr($part, 0, 1)) ->filter() ->only([0, count(explode(' ', $name ?? '')) - 1]) ->implode('');

Thank you!

Please confirm (incomplete submissions will not be addressed)

  • I have provided easy and step-by-step instructions to reproduce the bug.
  • I have provided code samples as text and NOT images.
  • I understand my bug report will be closed if I haven't met the criteria above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions