inveniosoftware / react-searchkit

React component library for interacting with a REST API.
https://inveniosoftware.github.io/react-searchkit/
MIT License
78 stars 40 forks source link

Add "prefix" and "suffix" props to components #104

Closed ntarocco closed 4 years ago

ntarocco commented 4 years ago

For some components it would be nice to pass a "prefix" and a "suffix" component so that the component itself can be rendered in the middle. For example, for the component ResultsPerPage it would be nice to have:

<ResultsPerPage
  prefix={'Show '}
  suffix={' results per page'}

so that it then renders: Show 30 results per page

On top of that, if the component does not render because there are 0 results, the prefix and suffix are also hidden. Currently it is not possible.