Skip to content

Commit 9bbea6e

Browse files
authored
Merge pull request #815 from mathbalduino/Paginator/allow-custom-maxLength
2 parents 3e7d763 + cbe8436 commit 9bbea6e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/components/Paginator/Paginator.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,15 @@ export interface PaginatorProps {
2222
* Called when the current page is changed.
2323
*/
2424
onChange?(page: number): void
25+
26+
/**
27+
* Customize the maxLength prop of the paginator input.
28+
*/
29+
maxLength?: number
2530
}
2631

2732
export function Paginator(props: PaginatorProps) {
28-
const { page, total, onChange } = props
33+
const { page, total, onChange, maxLength } = props
2934
const locale = useLocale()
3035

3136
const [inputValue, setInputValue] = useState<string>(`${page + 1}`)
@@ -86,7 +91,7 @@ export function Paginator(props: PaginatorProps) {
8691
onBlur={handleInputBlur}
8792
onKeyDown={handleInputKeyPress}
8893
clearable={false}
89-
maxLength={4}
94+
maxLength={maxLength ?? 4}
9095
title={locale.paginator.currentPage}
9196
/>
9297

0 commit comments

Comments
 (0)