react-uswds icon indicating copy to clipboard operation
react-uswds copied to clipboard

[feat] Add Page Number Value to Pagination Buttons

Open etanb opened this issue 1 year ago • 1 comments

Does your feature request relate to a specific USWDS component?

Pagination specifically: https://github.com/trussworks/react-uswds/blob/main/src/components/Pagination/Pagination.tsx

What USWDS Version is this feature present in?

ALL

Is your feature request related to a problem? Please describe.

As of now, the only way to get the value of which page a user clicked within a Pagination component is by the .innerText. We should not be storing and reading values based on DOM strings.

Describe the solution you'd like

Simply add a value={page} or data-page={page} with the actual page number value for better readability and structure:

https://github.com/trussworks/react-uswds/blob/main/src/components/Pagination/Pagination.tsx#L43-L54

etanb avatar Jun 14 '24 16:06 etanb