Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFR] Export and document TabbedShowLayoutTabs #2929

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions docs/Show.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,32 @@ export const PostShow = (props) => (
```
{% endraw %}


### Tabs element

By default, `<TabbedShowLayout>` renders its tabs using `<TabbedShowLayoutTabs>`, an internal react-admin component. You can pass a custom component as the `tabs` prop to override that default. Also, props passed to `<TabbedShowLayoutTabs>` are passed to the material-ui's `<Tabs>` component inside `<TabbedShowLayoutTabs>`. That means you can create a custom `tabs` component without copying several components from the react-admin source.

For instance, to make use of scrollable `<Tabs>`, you can pass a scrollable props to `<TabbedShowLayoutTabs>` and use it in the `tabs` prop from `<TabbedShowLayout>` as follows:

```jsx
import {
Show,
TabbedShowLayout,
TabbedShowLayoutTabs,
} from 'react-admin';

const ScrollableTabbedShowLayout = props => (
<Show{...props}>
<TabbedShowLayout tabs={<TabbedShowLayoutTabs scrollable={true}/>}>
...
</TabbedShowLayout>
</Show>
);

export default ScrollableTabbedShowLayout;

```

## Displaying Fields depending on the user permissions

You might want to display some fields only to users with specific permissions. Those permissions are retrieved for each route and will provided to your component as a `permissions` prop.
Expand Down
2 changes: 2 additions & 0 deletions packages/ra-ui-materialui/src/detail/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import ShowGuesser from './ShowGuesser';
import SimpleShowLayout from './SimpleShowLayout';
import TabbedShowLayout from './TabbedShowLayout';
import Tab from './Tab';
import TabbedShowLayoutTabs from './TabbedShowLayoutTabs';

export {
Create,
Expand All @@ -28,4 +29,5 @@ export {
SimpleShowLayout,
TabbedShowLayout,
Tab,
TabbedShowLayoutTabs,
};