Skip to content

Improve naming and separation of attributes for input fields #3038

@tabuna

Description

@tabuna

Problem:
Currently, to set a label above an input field, the title method is used:

Input::make('name')
    ->title('Your name')

However, using title is not entirely correct, as in HTML the title attribute is intended to provide advisory information about the element, not for displaying the main label of the field.

Proposed solution:
Introduce a separate label method for the main field label, keeping title for advisory or helper text. This aligns with practices in Bootstrap, Windows Forms, and other popular UI frameworks:

Input::make('name')
    ->label('Your name')           // Main label above the field
    ->title('Enter your name here') // Hint or advisory information

Benefits of this separation:

  1. Correct terminology and semantic meaning.
  2. Greater flexibility when building interfaces.

Backward compatibility:
To avoid breaking existing code, the title method can remain. If label is not set, its value can be automatically assigned from title. This will preserve the current behavior.

Metadata

Metadata

Assignees

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