Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@GayatriK2002
Copy link
Contributor

💡 What is the current behavior?

  • The values of text input, date input, and time input are left-aligned by default.
  • The value of number input is right-aligned by default.

GitHub Issue Number: #

🆕 What is the new behavior?

  • The textAlignment property allows customization of the text alignment in text input, date input, time input, and number input components.
  • By setting the textAlignment property to 'start' (default for text, date, and time inputs) or 'end' (default for number input), developers can control the alignment of the input values according to their specific requirements.

🏁 Checklist

A pull request can only be merged if all of these conditions are met (where applicable):

  • 🦮 Accessibility (a11y) features were implemented
  • 🗺️ Internationalization (i18n) - no hard coded strings
  • 📲 Responsiveness - components handle viewport changes and content overflow gracefully
  • 📕 Add or update a Storybook story
  • 📄 Documentation was reviewed/updated siemens/ix-docs
  • 🧪 Unit tests were added/updated and pass (pnpm test)
  • 📸 Visual regression tests were added/updated and pass (Guide)
  • 🧐 Static code analysis passes (pnpm lint)
  • 🏗️ Successful compilation (pnpm build, changes pushed)

👨‍💻 Help & support

@changeset-bot
Copy link

changeset-bot bot commented Oct 7, 2025

⚠️ No Changeset found

Latest commit: 90baf20

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@GayatriK2002 GayatriK2002 marked this pull request as ready for review October 7, 2025 09:24
@nuke-ellington
Copy link
Collaborator

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new textAlignment property to the ix-date-input, ix-input, ix-number-input, and ix-time-input components, allowing for customization of text alignment. The changes are consistently applied across the core, Angular, React, and Vue packages, and are supported by new documentation and visual regression tests. My review includes a suggestion to simplify the implementation of the text alignment styling, which will also improve internationalization support by using modern CSS properties. Overall, this is a valuable enhancement.

Comment on lines 392 to 394
style={{
textAlign: this.textAlignment === 'end' ? 'right' : 'left',
}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The text-align CSS property supports start and end values directly. Using these values is better for internationalization as it respects the text direction (LTR/RTL). You can simplify the code by removing the ternary operator.

Suggested change
style={{
textAlign: this.textAlignment === 'end' ? 'right' : 'left',
}}
style={{
textAlign: this.textAlignment,
}}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the code accordingly.

Comment on lines 108 to 110
style={{
textAlign: props.textAlignment === 'end' ? 'right' : 'left',
}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The text-align CSS property supports start and end values directly. Using these values is better for internationalization as it respects the text direction (LTR/RTL). You can simplify the code by removing the ternary operator.

Suggested change
style={{
textAlign: props.textAlignment === 'end' ? 'right' : 'left',
}}
style={{
textAlign: props.textAlignment,
}}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the code accordingly.

Comment on lines 379 to 381
style={{
textAlign: this.textAlignment === 'end' ? 'right' : 'left',
}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The text-align CSS property supports start and end values directly. Using these values is better for internationalization as it respects the text direction (LTR/RTL). You can simplify the code by removing the ternary operator.

Suggested change
style={{
textAlign: this.textAlignment === 'end' ? 'right' : 'left',
}}
style={{
textAlign: this.textAlignment,
}}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the code accordingly.

Copy link
Collaborator

@nuke-ellington nuke-ellington left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should change the first sentences of all JSDocs from this format:
Alignment of the input "xyz".
to something like this:

Text alignment within the input.

This should make it more clear 👍

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would make sense to all four configurations in combination with the text alignment here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I add VRTs for other input configurations where text-alignment works, such as inputs with slots using text-alignment = start?

@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants