React-table: How to add custom pagination icons?

Created on 18 Apr 2017  Â·  8Comments  Â·  Source: tannerlinsley/react-table

Can I replace the current pagination buttons for Prev and Next to custom arrow icons?

Most helpful comment

Include all props on the button like this:

All 8 comments

Absolutely! Just use your own component for the NextComponent and
PreviousComponent props
On Mon, Apr 17, 2017 at 10:06 PM Taher notifications@github.com wrote:

Can I replace the current pagination buttons for Prev and Next to custom
arrow icons?

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/tannerlinsley/react-table/issues/205, or mute the
thread
https://github.com/notifications/unsubscribe-auth/AFUmCTFqCtxAg2FKorJGve2_5OrUqWP3ks5rxDapgaJpZM4M_2LG
.

I'm trying to use my own component below here but I can't see the component render. Am I doing something wrong here?

class NextIcon extends Component {
  render() {
    return <button><img src="../assets/scroll-arrow-right.svg"/></button>;
  }
}

class PrevIcon extends Component {
  render() {
    return <button><img src="../assets/scroll-arrow-left.svg"/></button>;
  }
}

Object.assign(ReactTableDefaults, {
  PreviousComponent: <PrevIcon/>,
  NextComponent: <NextIcon/>
});

Try PreviousComponent: PrevIcon
On Mon, Apr 17, 2017 at 10:54 PM Taher notifications@github.com wrote:

I'm trying to use my own component below here but I can't see the
component render. Am I doing something wrong here?

class NextIcon extends Component {
render() {
return ;
}
}

class PrevIcon extends Component {
render() {
return ;
}
}

Object.assign(ReactTableDefaults, {
PreviousComponent: ,
NextComponent:
});

—
You are receiving this because you commented.

Reply to this email directly, view it on GitHub
https://github.com/tannerlinsley/react-table/issues/205#issuecomment-294677360,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFUmCQhSiDDAGcLO0KGa6KrqhRiXUzuTks5rxEIBgaJpZM4M_2LG
.

Now it renders but doesn't paginate.

Include all props on the button like this:

it works now. thanks.

You bet!

In case anyone else gets stumped by this:

PreviousComponent={props => <CustomButton {...props} />}

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LeonHex picture LeonHex  Â·  3Comments

monarajhans picture monarajhans  Â·  3Comments

alexanderwhatley picture alexanderwhatley  Â·  3Comments

panfiva picture panfiva  Â·  3Comments

Abdul-Hameed001 picture Abdul-Hameed001  Â·  3Comments