Add align and sidePadding attributes #172
Open
+32
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi! I did a few changes in the project to accomplish some layout characteristics that I couldn't do using only the options currently available in the component. Since it may be something useful to somebody else, I'm creating this PR to contribute.
The layout had the elements of the picker aligned to the left but the text of the elements still centered accordingly to their width. As in the following image:
As you can see, the element of value 1 is aligned with the center of the one of value 100.
To accomplish this, I created two new optional attributes:
np_align
andnp_sidePadding
. Both work only when the orientation is vertical. Thenp_align
attribute accepts three different values:left
,center
, andright
. As suggested by itself, thealign
attribute makes the component align its elements to the center (current and default behavior,) to the left, or to the right of the container. Thenp_sidePadding
(default: 0) is applied only when thealign
is not set tocenter
because it would not be useful in this case. When defined,np_sidePadding
adds a space between the side of the alignment in the container and the element.Please, let me know if it's not interesting for this library or if there is any change that must be done before merging.