Components: [Paginator] Allow for "appearance" attribute

Created on 11 Jun 2019  路  7Comments  路  Source: angular/components

Feature Description

The mat-form-field components can currently be styled app wide with MAT_FORM_FIELD_DEFAULT_OPTIONS.

On a per case basis, you can also override that default, using the appearance attribute.

mat-paginator also holds a mat-form-field, but it is currently not possible to alter that field's appearance.

Use Case

For the same reason you might want to change a particular mat-form-field's appearance, you might want to alter the appearance of the mat-form-field contained inside a mat-paginator.

To be fair, it is also because mat-paginator with a default fill appearance looks pretty broken now, and being able to set it to standard would be a good workaround to this issue.

P4 materiapaginator feature needs discussion

Most helpful comment

@BobDankert You could try providing an alternative value for MAT_FORM_FIELD_DEFAULT_OPTIONS lower down in the injector tree (such as providing it in the component that holds the paginator).

All 7 comments

@jelbourn / @mmalerba when will the discussion happen on this. Is there a way to be part of that discussion ?

Im suggesting to make a InjectionToken MAT_PAGINATOR_DEFAULT_OPTIONS where
appearance and DEFAULT_PAGE_SIZE can be provided.

Does anyone have any workarounds for this, while we wait for a solution? (Other than the obvious "don't use MAT_FORM_FIELD_DEFAULT_OPTIONS")

@BobDankert You could try providing an alternative value for MAT_FORM_FIELD_DEFAULT_OPTIONS lower down in the injector tree (such as providing it in the component that holds the paginator).

Thanks - worked perfectly! I didn't realize I could set that on a per-component basis - I had always been setting it at the module level.

I would be willing to implement this if there is consensus on the approach.

Proposals:

  • Add MAT_PAGINATOR_DEFAULT_OPTIONS injection token with {formFieldAppearance: MatFormFieldAppearance} as type (as suggested by @andreElrico)

    • Add formFieldAppearance as input on mat-paginator

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Miiekeee picture Miiekeee  路  3Comments

3mp3ri0r picture 3mp3ri0r  路  3Comments

crutchcorn picture crutchcorn  路  3Comments

constantinlucian picture constantinlucian  路  3Comments

Hiblton picture Hiblton  路  3Comments