Advertisement
Guest User

Untitled

a guest
May 23rd, 2020
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. ---
  2. id: highlight_actions
  3. title: Actions
  4. ---
  5.  
  6. import MaterialTable from 'material-table';
  7. import { Button } from '@material-ui/core';
  8.  
  9. You can add buttons to rows or toolbar by using actions prop. Actions prop takes array of actions.
  10.  
  11. ### Usage
  12.  
  13. ```jsx
  14. <MaterialTable
  15. // other props
  16. actions={[
  17. {
  18. icon: 'save',
  19. tooltip: 'Save User',
  20. onClick: (event, rowData) => {
  21. // Do save operation
  22. }
  23. }
  24. ]}
  25. />
  26. ```
  27.  
  28. ### Demo 1
  29.  
  30. ```jsx live
  31. // Using import from .mdx file
  32.  
  33. /**
  34. *
  35. * WON'T LET ME COMPILE THIS BUT I CAN RUN IT IN DEV (USING yarn start)
  36. *
  37. */
  38.  
  39. // function Demo(props) {
  40. // return (
  41. // <Button color="secondary">
  42. // Button From @material-ui/core
  43. // </Button>
  44. // );
  45. // }
  46. ```
  47.  
  48. ### Demo 2
  49.  
  50. ```jsx live
  51. // Import in jsx live
  52. import { Button } from '@material-ui/core';
  53.  
  54. function Demo(props) {
  55. return (
  56. <Button color="secondary">
  57. Button From @material-ui/core
  58. </Button>
  59. );
  60. }
  61. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement