Examples › Using with Mantine ContextMenu

Mantine doesn’t have a context-menu component, but the DataTable works perfectly with Mantine ContextMenu, built by the same author. Have a look at the examples below to learn how.

Row context-menu

Here’s how you could use the onRowContextMenu property to create this useful functionality for your data-rich desktop applications:

Name
Street address
City
State
Feest, Bogan and Herzog21716 Ratke DriveStromanportWY
Cummerata - Kuhlman6389 Dicki StreamSouth GateNH
Goyette Inc8873 Mertz RapidDorthysideID
Runte Inc2996 Ronny MountMcAllenMA
Goldner, Rohan and Lehner632 Broadway AvenueNorth LouieWY
Doyle, Hodkiewicz and O'Connell576 Joyce WaysTyraburghKS
Rau - O'Hara7508 Lansdowne RoadShieldsboroughMI
Tillman - Jacobi57918 Gwendolyn CirclesSheridanportMI
Connelly, Feest and Hodkiewicz7057 Stanley RoadKearaburghCA
Shanahan, Robel and Beier378 Berta CrescentWest GerryKS
Kling - McLaughlin8346 Kertzmann SquareSouth JoesphID
Jogi - McLaughlin83462 Shazam StreetNorth JoesphID
Jogi - McLaughlin83462 Shazam StreetNorth JoesphID
No records

Here’s the code for the example above:

'use client';
// 👆 Since 'useContextMenu' is a hook, don't forget to add the 'use client' directive
//    at the top of your file if you're using it in a RSC context

import { useMediaQuery } from '@mantine/hooks';
import { showNotification } from '@mantine/notifications';
import { IconEdit, IconEye, IconTrash } from '@tabler/icons-react';
import { DataTable } from 'mantine-datatable';
import { useContextMenu } from 'mantine-contextmenu';
import companies from '~/data/companies.json';

export function RowContextMenuExample() {
  const { showContextMenu } = useContextMenu();
  const isTouch = useMediaQuery('(pointer: coarse)');

  return (
    <DataTable
      withTableBorder
      withColumnBorders
      textSelectionDisabled={isTouch} // 👈 disable text selection on touch devices
      columns={[{ accessor: 'name' }, { accessor: 'streetAddress' }, { accessor: 'city' }, { accessor: 'state' }]}
      records={companies}
      onRowContextMenu={({ record, event }) =>
        showContextMenu([
          {
            key: 'view-company-details',
            icon: <IconEye size={16} />,
            onClick: () =>
              showNotification({
                message: `Clicked on view context-menu action for ${record.name} company`,
                withBorder: true,
              }),
          },
          {
            key: 'edit-company-information',
            icon: <IconEdit size={16} />,
            onClick: () =>
              showNotification({
                message: `Clicked on edit context-menu action for ${record.name} company`,
                withBorder: true,
              }),
          },
          { key: 'divider' },
          {
            key: 'delete-company',
            icon: <IconTrash size={16} />,
            color: 'red',
            onClick: () =>
              showNotification({
                color: 'red',
                message: `Clicked on delete context-menu action for ${record.name} company`,
                withBorder: true,
              }),
          },
        ])(event)
      }
    />
  );
}

Using with scrollable tables

By default, a Mantine ContextMenu will automatically place an overlay over the entire page and close when the user clicks it, hits the Escape key, scrolls the or resizes the browser window. However, when using a scrollable DataTable, the user can still scroll the table using the arrow keys, so you might need to close the context-menu when the user scrolls the table by passing the hideContextMenu function returned by the useContextMenu hook to the onScroll property of the DataTable:

First name
Last name
Email
JeraldHowellJerald.Howell32@yahoo.com
KathleenRueckerKathleen_Ruecker@hotmail.com
EricaVolkmanErica.Volkman37@gmail.com
CliffordOberbrunnerClifford.Oberbrunner@hotmail.com
AlisonKlingAlison16@gmail.com
SueZiemeSue.Zieme29@hotmail.com
FeliciaGleasonFelicia30@yahoo.com
AlfredoZemlakAlfredo22@yahoo.com
EmilyBartolettiEmily.Bartoletti@gmail.com
DeloresReynoldsDelores.Reynolds@yahoo.com
LouisSchambergerLouis6@yahoo.com
BeverlyHellerBeverly_Heller@gmail.com
EugeneFeestEugene88@hotmail.com
MartinBahringerMartin_Bahringer10@gmail.com
EllisMillerEllis36@hotmail.com
GloriaColeGloria41@gmail.com
LindaWittingLinda_Witting@yahoo.com
GreggKutchGregg_Kutch8@yahoo.com
MamieRaynorMamie58@hotmail.com
ErickBruenErick_Bruen13@yahoo.com
FaithLangworthFaith_Langworth14@gmail.com
AliciaLeannonAlicia62@yahoo.com
BoydMohrBoyd.Mohr@hotmail.com
LindseyHeidenreichLindsey31@yahoo.com
ElsaMarvinElsa.Marvin2@gmail.com
DebbieHagenesDebbie.Hagenes@hotmail.com
LionelMcCulloughLionel_McCullough@gmail.com
KimLebsackKim.Lebsack66@yahoo.com
RolandoWeissnatRolando83@hotmail.com
JacquelineLeschJacqueline35@hotmail.com
FelixStokesFelix77@hotmail.com
ReneeTillmanRenee.Tillman@yahoo.com
RichardWatsicaRichard_Watsica@yahoo.com
NathanWolfNathan.Wolf@gmail.com
JonathanKeebler-CronaJonathan.Keebler-Crona90@gmail.com
KathleenSpinkaKathleen_Spinka58@hotmail.com
BerniceSchinnerBernice45@hotmail.com
AdamPagacAdam58@hotmail.com
EarlRyanEarl.Ryan@gmail.com
GregBaileyGreg.Bailey@hotmail.com
AnnePowlowskiAnne_Powlowski69@gmail.com
AbrahamDooleyAbraham_Dooley@gmail.com
MyronLemkeMyron_Lemke@gmail.com
DiannaGislason-LeschDianna88@hotmail.com
ReginaldHagenesReginald_Hagenes51@gmail.com
SheliaTurcotteShelia68@yahoo.com
CarltonJenkinsCarlton_Jenkins62@gmail.com
LanceWiegandLance_Wiegand@gmail.com
RubyGrahamRuby20@hotmail.com
HattieCollierHattie60@hotmail.com
ViolaRathViola_Rath6@gmail.com
RolandHuelRoland_Huel@yahoo.com
LeticiaWiegandLeticia65@hotmail.com
JacquelineKulasJacqueline.Kulas@hotmail.com
CristinaJaskolskiCristina.Jaskolski@hotmail.com
FelipeDaughertyFelipe_Daugherty@hotmail.com
TimothyHeaneyTimothy.Heaney@gmail.com
AlonzoKutchAlonzo12@yahoo.com
KeithKlingKeith25@yahoo.com
JaniceGoyetteJanice93@gmail.com
HelenKunze-MacGyverHelen_Kunze-MacGyver@gmail.com
BarryJastBarry.Jast@yahoo.com
RamiroCummingsRamiro.Cummings30@hotmail.com
AntonioLittle-BahringerAntonio.Little-Bahringer@gmail.com
SamuelZemlakSamuel_Zemlak@gmail.com
DorisEmardDoris_Emard8@gmail.com
OliviaAbernathyOlivia_Abernathy@yahoo.com
JustinKohlerJustin_Kohler42@hotmail.com
ScottOberbrunnerScott.Oberbrunner57@hotmail.com
YolandaSpinkaYolanda.Spinka76@hotmail.com
BradUllrich-OrnBrad30@yahoo.com
GloriaFisherGloria.Fisher22@gmail.com
SergioCristSergio_Crist93@gmail.com
TheresaSporerTheresa.Sporer85@hotmail.com
TheodoreWiegandTheodore58@yahoo.com
RudyRoweRudy_Rowe25@gmail.com
KurtRaynorKurt.Raynor@hotmail.com
RuthMedhurstRuth.Medhurst97@yahoo.com
TimAbernathyTim0@yahoo.com
RebeccaRunolfsdottirRebecca.Runolfsdottir41@gmail.com
AngelAufderharAngel.Aufderhar19@yahoo.com
JavierBergstromJavier12@yahoo.com
LeighKlockoLeigh.Klocko77@hotmail.com
TaylorRiceTaylor30@yahoo.com
CindyGoldnerCindy_Goldner47@yahoo.com
ShannonCristShannon88@hotmail.com
SarahMaggioSarah54@hotmail.com
CarltonLangosh-GloverCarlton.Langosh-Glover@gmail.com
FeliciaRoobFelicia_Roob65@yahoo.com
SimonKuhicSimon30@yahoo.com
SharonDanielSharon.Daniel2@hotmail.com
ErinBayerErin4@hotmail.com
ErikaPowlowski-CorwinErika33@gmail.com
VickyPollichVicky_Pollich18@hotmail.com
FeliciaZiemannFelicia.Ziemann56@gmail.com
ColleenCrooksColleen84@hotmail.com
JimmyFisherJimmy7@yahoo.com
LulaReichertLula.Reichert48@gmail.com
BethanySchinnerBethany.Schinner@yahoo.com
AllenHackettAllen44@hotmail.com
EarlWillmsEarl_Willms81@hotmail.com
NormaDibbertNorma.Dibbert@yahoo.com
RicardoFraneckiRicardo_Franecki@hotmail.com
PatriciaSchulistPatricia95@gmail.com
MurielBahringerMuriel_Bahringer@hotmail.com
RicardoSchowalterRicardo_Schowalter9@yahoo.com
TerryBeier-O'ReillyTerry.Beier-OReilly92@hotmail.com
SidneyNaderSidney47@hotmail.com
FeliciaBeahanFelicia.Beahan97@yahoo.com
TimothyWintheiserTimothy_Wintheiser61@yahoo.com
DarylKautzerDaryl_Kautzer56@hotmail.com
PerryTillmanPerry.Tillman57@yahoo.com
GreggQuitzonGregg.Quitzon@yahoo.com
ArmandoLindArmando_Lind@gmail.com
IrmaKilbackIrma27@gmail.com
StacyDavisStacy_Davis@hotmail.com
AustinO'ConnerAustin33@yahoo.com
IraKemmerIra_Kemmer76@yahoo.com
GabrielKossGabriel_Koss92@gmail.com
LisaReichertLisa.Reichert@hotmail.com
DarrinHaagDarrin17@hotmail.com
MarianneGibsonMarianne69@hotmail.com
LoisRathLois_Rath@hotmail.com
AngelaMosciskiAngela35@hotmail.com
CharlieRosenbaumCharlie.Rosenbaum58@gmail.com
AgnesSimonisAgnes.Simonis27@hotmail.com
KennethFarrell-AltenwerthKenneth57@gmail.com
MichelleLefflerMichelle.Leffler@gmail.com
AlfredoAltenwerthAlfredo.Altenwerth@hotmail.com
MeredithVolkmanMeredith.Volkman@gmail.com
BenjaminGottliebBenjamin23@yahoo.com
IreneBrekkeIrene_Brekke@hotmail.com
ElsieMannElsie.Mann20@hotmail.com
KimEbertKim.Ebert@hotmail.com
EmilyBlandaEmily26@hotmail.com
CliftonFeeneyClifton60@yahoo.com
DavidO'KeefeDavid15@hotmail.com
MarcoRaynorMarco_Raynor@gmail.com
JoannJohnsonJoann_Johnson@yahoo.com
ElaineKonopelskiElaine_Konopelski@hotmail.com
WinstonLemkeWinston58@yahoo.com
HeatherFraneyHeather_Franey@yahoo.com
JonathanHermistonJonathan_Hermiston@yahoo.com
JeannieDoyleJeannie.Doyle86@gmail.com
AngeloDietrichAngelo.Dietrich@hotmail.com
TracyHintzTracy.Hintz@yahoo.com
ShawnaJaskolskiShawna_Jaskolski@hotmail.com
CandaceGradyCandace.Grady@yahoo.com
PriscillaGulgowskiPriscilla_Gulgowski@yahoo.com
RolandoHellerRolando_Heller@hotmail.com
SandyTillmanSandy2@hotmail.com
JosephineStoltenbergJosephine_Stoltenberg65@gmail.com
ShirleyHellerShirley57@gmail.com
WilmaSchroederWilma_Schroeder99@hotmail.com
NatashaBergeNatasha81@yahoo.com
GertrudeKlockoGertrude_Klocko@gmail.com
GeraldineAltenwerthGeraldine51@yahoo.com
JimNienowJim_Nienow7@gmail.com
OrvilleSchmidtOrville_Schmidt@yahoo.com
KathyOlsonKathy.Olson29@hotmail.com
BertDickiBert_Dicki45@hotmail.com
JoySchummJoy.Schumm@hotmail.com
LaurenEbertLauren_Ebert@gmail.com
BlancheZulaufBlanche24@gmail.com
BruceVeumBruce_Veum93@gmail.com
KatieRutherfordKatie80@yahoo.com
CaryKerlukeCary18@hotmail.com
CarlCronaCarl29@hotmail.com
AltonLangoshAlton_Langosh46@hotmail.com
BradfordTrantowBradford.Trantow82@gmail.com
JessieLarsonJessie_Larson@hotmail.com
TriciaStantonTricia15@yahoo.com
RobertoEbertRoberto_Ebert@yahoo.com
SharonWolffSharon.Wolff79@gmail.com
GladysSanfordGladys.Sanford19@hotmail.com
FannieMcClureFannie_McClure@hotmail.com
MaryFeilMary.Feil@yahoo.com
ReneJastRene_Jast@gmail.com
MaryStreichMary.Streich@gmail.com
LindseyGrantLindsey.Grant@hotmail.com
AliciaWehnerAlicia_Wehner@yahoo.com
KimJacobsKim41@yahoo.com
KirkDooleyKirk61@yahoo.com
MurielSimonisMuriel.Simonis32@hotmail.com
AmberDietrichAmber29@hotmail.com
NelsonMayerNelson.Mayer@gmail.com
JosephineStantonJosephine_Stanton@yahoo.com
RonaldCristRonald_Crist99@yahoo.com
RandolphTorphyRandolph99@hotmail.com
FreddieMedhurstFreddie30@hotmail.com
JoshLehnerJosh90@hotmail.com
MadelineKuhnMadeline43@hotmail.com
TammyJonesTammy6@hotmail.com
WilfredArmstrongWilfred.Armstrong@yahoo.com
CristinaMcClureCristina9@hotmail.com
IrmaOlsonIrma25@hotmail.com
NealZboncakNeal.Zboncak57@hotmail.com
WillieRunolfsdottirWillie_Runolfsdottir@gmail.com
WinstonBartonWinston24@yahoo.com
GerardoStoltenbergGerardo.Stoltenberg@hotmail.com
LouisHandLouis88@yahoo.com
BruceQuitzonBruce20@yahoo.com
CharlieBeierCharlie.Beier37@yahoo.com
SaulLangSaul4@yahoo.com
NathanSwaniawskiNathan29@yahoo.com
MaureenDuBuqueMaureen39@hotmail.com
VeraBuckridgeVera14@hotmail.com
KendraGusikowskiKendra_Gusikowski@yahoo.com
AlfonsoLarsonAlfonso.Larson@hotmail.com
JamieBergeJamie_Berge59@hotmail.com
SidneyMcKenzieSidney_McKenzie49@hotmail.com
VelmaTerryVelma55@hotmail.com
MiriamSchadenMiriam.Schaden48@gmail.com
GenevaFerryGeneva.Ferry@gmail.com
JulianJohnsJulian_Johns27@gmail.com
HerbertD'AmoreHerbert_DAmore@gmail.com
KatherineSchadenKatherine49@hotmail.com
RamonHeathcoteRamon.Heathcote@gmail.com
ClayShieldsClay.Shields@yahoo.com
GrantSchneiderGrant_Schneider@yahoo.com
LorraineGibsonLorraine_Gibson74@hotmail.com
ByronRomagueraByron_Romaguera34@hotmail.com
SethBoyerSeth.Boyer@gmail.com
FernandoCreminFernando.Cremin@yahoo.com
JeanneBrekkeJeanne52@hotmail.com
DelbertFeilDelbert_Feil@yahoo.com
JeanRennerJean.Renner@gmail.com
TerrenceGleichnerTerrence.Gleichner@hotmail.com
LoriSpinkaLori_Spinka@hotmail.com
NormaMrazNorma.Mraz@yahoo.com
TimmyRyanTimmy.Ryan3@yahoo.com
SheilaHansenSheila_Hansen63@hotmail.com
StaceyBatzStacey_Batz@gmail.com
IsmaelKiehnIsmael_Kiehn5@yahoo.com
KirkHilpertKirk_Hilpert@hotmail.com
DanielGleichnerDaniel.Gleichner@yahoo.com
PedroKemmerPedro16@yahoo.com
NormaManteNorma_Mante@hotmail.com
GraceHoweGrace83@hotmail.com
TimmyMcKenzieTimmy.McKenzie@gmail.com
ColleenBlockColleen_Block@yahoo.com
CarrollCrooksCarroll.Crooks@yahoo.com
TommieSporerTommie57@gmail.com
AgnesConnAgnes_Conn@yahoo.com
JuanaGreenfelderJuana35@yahoo.com
MeghanReynoldsMeghan26@gmail.com
PatGislasonPat.Gislason@yahoo.com
TracyGulgowskiTracy81@yahoo.com
ElsieCollinsElsie.Collins@yahoo.com
AlexandraZiemannAlexandra.Ziemann@hotmail.com
BridgetCummerataBridget_Cummerata@gmail.com
EarlBuckridgeEarl36@yahoo.com
LynetteDeckowLynette_Deckow92@hotmail.com
MackRueckerMack_Ruecker2@hotmail.com
AllanMertzAllan_Mertz@yahoo.com
MalcolmSpinka-StammMalcolm_Spinka-Stamm@yahoo.com
RogelioProhaskaRogelio93@gmail.com
ChristieKuvalisChristie85@hotmail.com
LenaKrajcikLena.Krajcik@yahoo.com
SusanRomagueraSusan_Romaguera@gmail.com
JulieTowneJulie_Towne85@gmail.com
NicolasPadbergNicolas8@yahoo.com
SabrinaOrtizSabrina_Ortiz@yahoo.com
HaroldVonHarold_Von@hotmail.com
LucyJohnston-HaneLucy_Johnston-Hane@hotmail.com
ShawnaHomenickShawna37@yahoo.com
BrandiFerryBrandi.Ferry22@gmail.com
StaceyHermann-VolkmanStacey.Hermann-Volkman69@yahoo.com
LauraFadelLaura.Fadel78@yahoo.com
HildaHaleyHilda.Haley@gmail.com
AdrianPadbergAdrian.Padberg@yahoo.com
TamaraLangTamara2@yahoo.com
BlancheLuettgenBlanche.Luettgen@gmail.com
RoseZboncakRose25@yahoo.com
AllanHilllAllan.Hilll52@yahoo.com
JakeMayertJake.Mayert65@gmail.com
LatoyaBrakus-DonnellyLatoya_Brakus-Donnelly@gmail.com
ThelmaLindgrenThelma_Lindgren@hotmail.com
StevenOberbrunnerSteven_Oberbrunner29@yahoo.com
DomingoWeimann-JerdeDomingo_Weimann-Jerde16@hotmail.com
ChelseaWildermanChelsea26@hotmail.com
TamiSchowalterTami13@yahoo.com
TerenceGrimesTerence_Grimes@gmail.com
EstelleMuellerEstelle.Mueller@gmail.com
DominickTorpDominick.Torp@gmail.com
PatBergePat_Berge97@gmail.com
MindyFisherMindy31@gmail.com
FredSmithFred_Smith@gmail.com
SonyaHagenesSonya.Hagenes14@hotmail.com
LucyEmardLucy_Emard@yahoo.com
DellaMcCulloughDella.McCullough86@hotmail.com
BarbaraMcClureBarbara.McClure79@hotmail.com
VickieBruenVickie.Bruen@yahoo.com
HeatherBergstromHeather17@yahoo.com
EvanDenesik-WalshEvan.Denesik-Walsh@gmail.com
GertrudeEbertGertrude67@yahoo.com
RudySwaniawskiRudy92@gmail.com
MyraStrackeMyra_Stracke81@hotmail.com
BennyFaheyBenny.Fahey5@yahoo.com
BerniceTillmanBernice.Tillman15@hotmail.com
AlbertProsaccoAlbert_Prosacco76@hotmail.com
MonaLarsonMona.Larson@hotmail.com
MelbaMorissetteMelba.Morissette@hotmail.com
ShawnDareShawn70@gmail.com
JulioNitzscheJulio.Nitzsche2@yahoo.com
DianneHaneDianne_Hane@gmail.com
TyroneGoldnerTyrone_Goldner42@yahoo.com
WendyHilpertWendy_Hilpert@yahoo.com
RoxanneCronaRoxanne_Crona@gmail.com
JackieJohnsonJackie_Johnson74@hotmail.com
JoannSengerJoann15@hotmail.com
FelixHackettFelix.Hackett82@yahoo.com
ByronChamplinByron47@yahoo.com
LeoBeahanLeo_Beahan@gmail.com
GerardoGulgowskiGerardo_Gulgowski48@hotmail.com
SandraMcKenzieSandra.McKenzie73@yahoo.com
CassandraSchneiderCassandra_Schneider51@hotmail.com
WillisRosenbaumWillis66@yahoo.com
IgnacioFritschIgnacio4@hotmail.com
ConstanceGleichnerConstance.Gleichner@hotmail.com
CarlKautzerCarl_Kautzer@hotmail.com
MelvinTorphyMelvin_Torphy@yahoo.com
PatriciaVeumPatricia58@hotmail.com
EvelynKossEvelyn_Koss32@yahoo.com
JuanaD'AmoreJuana_DAmore27@hotmail.com
SandySchneiderSandy4@hotmail.com
IgnacioAufderharIgnacio.Aufderhar33@hotmail.com
PatStroman-SpencerPat_Stroman-Spencer23@yahoo.com
TommieOndrickaTommie_Ondricka96@gmail.com
FloraLittelFlora60@hotmail.com
OrlandoBorerOrlando.Borer@hotmail.com
RubenErdmanRuben_Erdman46@gmail.com
EduardoThielEduardo.Thiel@hotmail.com
DiannaTreutelDianna.Treutel@hotmail.com
WillardBlickWillard.Blick80@gmail.com
DoloresSmithDolores.Smith83@gmail.com
JimmyBalistreriJimmy.Balistreri12@yahoo.com
JonathonFisherJonathon.Fisher@gmail.com
WayneGutkowskiWayne25@yahoo.com
AngelKossAngel.Koss@yahoo.com
RufusCreminRufus14@hotmail.com
AnnaBayerAnna_Bayer@gmail.com
AnneKingAnne65@yahoo.com
HannahKrajcik-VeumHannah.Krajcik-Veum@hotmail.com
AlexisDavisAlexis_Davis42@hotmail.com
TerenceDanielTerence.Daniel@gmail.com
JohnDonnellyJohn.Donnelly21@gmail.com
LeoBeierLeo_Beier66@gmail.com
MirandaQuigleyMiranda.Quigley3@gmail.com
AlexHillsAlex.Hills@hotmail.com
JanisRogahnJanis32@hotmail.com
LaurieHarveyLaurie_Harvey@hotmail.com
EileenBoyleEileen_Boyle@gmail.com
ClaudeEmardClaude_Emard95@yahoo.com
FrankHarrisFrank10@hotmail.com
SheriBoyleSheri_Boyle@yahoo.com
IrvinFramiIrvin.Frami83@hotmail.com
ShelleyBlickShelley.Blick25@hotmail.com
SonyaTorpSonya.Torp45@gmail.com
MarjorieSauerMarjorie.Sauer@yahoo.com
ClaudeKuvalisClaude_Kuvalis88@hotmail.com
JodiFarrellJodi19@gmail.com
ErikHansenErik.Hansen@hotmail.com
GustavoRohanGustavo_Rohan83@hotmail.com
CedricHagenesCedric78@hotmail.com
MarcoMacGyverMarco.MacGyver62@gmail.com
ConnieZemlakConnie_Zemlak@gmail.com
GeorgiaDareGeorgia57@hotmail.com
RochelleBahringerRochelle81@yahoo.com
SonyaBergnaumSonya_Bergnaum@yahoo.com
GaryRosenbaumGary66@yahoo.com
BrendanWilliamson-D'AmoreBrendan34@yahoo.com
AlbertJacobiAlbert8@hotmail.com
ElsieMohrElsie_Mohr37@gmail.com
JuneSpinkaJune_Spinka67@yahoo.com
JuliaDoyleJulia6@yahoo.com
JacquelynDuBuqueJacquelyn32@yahoo.com
BerniceUptonBernice90@hotmail.com
JoeyFarrellJoey_Farrell99@yahoo.com
VivianHackettVivian.Hackett46@gmail.com
AngieAbbottAngie57@hotmail.com
LoisGorczanyLois.Gorczany@yahoo.com
BrentLockmanBrent_Lockman@yahoo.com
MaxRobertsMax.Roberts@yahoo.com
BetsyMcClure-WildermanBetsy_McClure-Wilderman@gmail.com
LatoyaHyattLatoya_Hyatt81@yahoo.com
TedConsidine-McCulloughTed26@hotmail.com
WilmaSimonisWilma17@yahoo.com
KeithMurphyKeith.Murphy@yahoo.com
AprilBaumbachApril58@gmail.com
JuanHarrisJuan7@yahoo.com
DouglasStreichDouglas.Streich@gmail.com
LyleKubLyle_Kub@hotmail.com
SabrinaVolkmanSabrina79@gmail.com
KrystalVandervortKrystal_Vandervort@gmail.com
MelodyFlatleyMelody.Flatley@yahoo.com
RochelleWilliamsonRochelle21@gmail.com
RhondaBradtkeRhonda.Bradtke@gmail.com
VickiRennerVicki93@yahoo.com
TaraRobertsTara.Roberts@hotmail.com
JoyKoelpinJoy.Koelpin@yahoo.com
RodneyKiehnRodney.Kiehn41@hotmail.com
StellaDanielStella_Daniel29@yahoo.com
DavidJohnstonDavid52@yahoo.com
BobbyTrantowBobby_Trantow61@hotmail.com
ToddStiedemannTodd_Stiedemann39@yahoo.com
MaxineCronaMaxine.Crona19@hotmail.com
ArturoMurrayArturo.Murray17@yahoo.com
MargueriteGreenfelderMarguerite_Greenfelder21@yahoo.com
KristaSchroederKrista61@gmail.com
NettieBruenNettie_Bruen@gmail.com
DianeChristiansenDiane.Christiansen95@yahoo.com
DennisBeahanDennis_Beahan65@yahoo.com
JeromeHeaneyJerome96@gmail.com
ColinLeuschkeColin3@gmail.com
PrestonKeelingPreston_Keeling5@hotmail.com
GordonFayGordon20@hotmail.com
JanetBahringerJanet.Bahringer@hotmail.com
MartaTorpMarta6@hotmail.com
JanaJenkinsJana_Jenkins36@hotmail.com
AndyMcClureAndy29@yahoo.com
HarryPaucekHarry.Paucek65@yahoo.com
SusanBeerSusan_Beer@hotmail.com
GlenReichertGlen8@gmail.com
NormanWitting-WizaNorman27@gmail.com
LeonardAnkundingLeonard.Ankunding@hotmail.com
CharlesGutmannCharles68@yahoo.com
AmeliaBernhard-LangAmelia_Bernhard-Lang@gmail.com
ArmandoOkunevaArmando56@gmail.com
SonjaMurraySonja2@hotmail.com
KrystalSchillerKrystal42@gmail.com
LucasKutchLucas95@yahoo.com
RoderickGulgowskiRoderick_Gulgowski11@hotmail.com
EileenKshlerinEileen92@hotmail.com
TeriJohnsonTeri_Johnson77@yahoo.com
JeannieZemlak-BeckerJeannie_Zemlak-Becker36@yahoo.com
ElsaJacobiElsa84@yahoo.com
CeciliaAndersonCecilia.Anderson92@yahoo.com
MinnieSchmidtMinnie23@yahoo.com
WinstonHoegerWinston.Hoeger58@yahoo.com
ElaineHermanElaine12@yahoo.com
LewisHoweLewis84@hotmail.com
AlmaLindAlma.Lind@hotmail.com
JohnnyHintzJohnny.Hintz64@yahoo.com
MatthewDanielMatthew.Daniel89@hotmail.com
SaulBoscoSaul.Bosco@hotmail.com
CarrollHeaneyCarroll.Heaney21@hotmail.com
AdamKrajcikAdam93@yahoo.com
LouisSteuberLouis.Steuber32@hotmail.com
LucyTurnerLucy89@gmail.com
GeraldLynchGerald_Lynch@gmail.com
DarnellWeberDarnell10@yahoo.com
GilbertoKeeblerGilberto_Keebler96@hotmail.com
ClayHeidenreichClay_Heidenreich@yahoo.com
ClaudiaWindlerClaudia.Windler@hotmail.com
EdwardCummingsEdward.Cummings68@hotmail.com
SheilaWalter-DouglasSheila51@hotmail.com
ArthurRobertsArthur_Roberts@hotmail.com
LilaThompsonLila.Thompson@hotmail.com
RandyMannRandy.Mann63@yahoo.com
JessicaRippinJessica.Rippin37@hotmail.com
JonathonRathJonathon17@gmail.com
ThomasHodkiewiczThomas.Hodkiewicz@hotmail.com
GeraldineNader-WalterGeraldine_Nader-Walter33@gmail.com
GloriaKohlerGloria25@gmail.com
AdrianSchillerAdrian_Schiller@yahoo.com
InezMooreInez_Moore@yahoo.com
DonaldOberbrunnerDonald_Oberbrunner28@yahoo.com
MikeLakinMike23@gmail.com
ElaineDaughertyElaine_Daugherty35@yahoo.com
GreggMillerGregg1@gmail.com
EthelSanfordEthel_Sanford@gmail.com
AlyssaKirlin-RippinAlyssa_Kirlin-Rippin@yahoo.com
EdithMcKenzieEdith74@gmail.com
TobyLarkinToby_Larkin@yahoo.com
JoyLarsonJoy95@hotmail.com
DanWizaDan.Wiza1@hotmail.com
LelandKilbackLeland.Kilback36@yahoo.com
SantiagoParkerSantiago_Parker5@hotmail.com
VickiBednarVicki_Bednar@gmail.com
GilbertPredovicGilbert.Predovic41@hotmail.com
MattHackettMatt29@yahoo.com
TinaSteuberTina_Steuber19@yahoo.com
WilmaHilllWilma.Hilll74@hotmail.com
BenjaminYost-JohnsBenjamin73@hotmail.com
LisaYundtLisa_Yundt@hotmail.com
DavidTorp-StehrDavid25@gmail.com
LoreneWiegandLorene.Wiegand@gmail.com
EssieMillsEssie98@yahoo.com
KristopherKutch-MoenKristopher_Kutch-Moen@gmail.com
MonaLoweMona_Lowe4@gmail.com
WinstonConsidineWinston.Considine@yahoo.com
SantosVolkmanSantos_Volkman@hotmail.com
CamilleWisokyCamille37@gmail.com
DesireeKingDesiree_King@hotmail.com
LorenaHeaneyLorena.Heaney44@yahoo.com
CarolLittelCarol.Littel@gmail.com
DianeWelchDiane_Welch69@yahoo.com
AlvinKundeAlvin55@hotmail.com
MinnieMorissetteMinnie52@gmail.com
No records

Here’s the code for the example above:

const { showContextMenu, hideContextMenu } = useContextMenu();
const isTouch = useMediaQuery('(pointer: coarse)');

return (
  <DataTable
    height={300}
    withTableBorder
    withColumnBorders
    textSelectionDisabled={isTouch} // 👈 disable text selection on touch devices
    columns={[{ accessor: 'firstName' }, { accessor: 'lastName' }, { accessor: 'email' }]}
    records={employees}
    onRowContextMenu={({ record, event }) =>
      showContextMenu([
        // context menu items...
      ])(event)
    }
    // 👇 make sure the context-menu is closed when the user scrolls the table
    onScroll={hideContextMenu}
  />
);

Cell context-menu

You can also use the onCellContextMenu property to create a context-menu for individual cells. In the example below, we’re showing a context-menu for the name column:

Name
Street address
City
State
Feest, Bogan and Herzog21716 Ratke DriveStromanportWY
Cummerata - Kuhlman6389 Dicki StreamSouth GateNH
Goyette Inc8873 Mertz RapidDorthysideID
Runte Inc2996 Ronny MountMcAllenMA
Goldner, Rohan and Lehner632 Broadway AvenueNorth LouieWY
Doyle, Hodkiewicz and O'Connell576 Joyce WaysTyraburghKS
Rau - O'Hara7508 Lansdowne RoadShieldsboroughMI
Tillman - Jacobi57918 Gwendolyn CirclesSheridanportMI
Connelly, Feest and Hodkiewicz7057 Stanley RoadKearaburghCA
Shanahan, Robel and Beier378 Berta CrescentWest GerryKS
Kling - McLaughlin8346 Kertzmann SquareSouth JoesphID
Jogi - McLaughlin83462 Shazam StreetNorth JoesphID
Jogi - McLaughlin83462 Shazam StreetNorth JoesphID
No records

Here’s the code for the example above:

const { showContextMenu } = useContextMenu();
const isTouch = useMediaQuery('(pointer: coarse)');

return (
  <DataTable
    withTableBorder
    withColumnBorders
    textSelectionDisabled={isTouch} // 👈 disable text selection on touch devices
    columns={[{ accessor: 'name' }, { accessor: 'streetAddress' }, { accessor: 'city' }, { accessor: 'state' }]}
    records={companies}
    onCellContextMenu={({ record, column, event }) => {
      if (column.accessor === 'name') {
        return showContextMenu([
          // context menu items...
        ])(event);
      }
    }}
  />
);

Mixing row and cell context-menus

You can also mix row and cell context-menus. In the example below, we’re showing a context-menu for the name column and a different one for the row:

Name
Street address
City
State
Feest, Bogan and Herzog21716 Ratke DriveStromanportWY
Cummerata - Kuhlman6389 Dicki StreamSouth GateNH
Goyette Inc8873 Mertz RapidDorthysideID
Runte Inc2996 Ronny MountMcAllenMA
Goldner, Rohan and Lehner632 Broadway AvenueNorth LouieWY
Doyle, Hodkiewicz and O'Connell576 Joyce WaysTyraburghKS
Rau - O'Hara7508 Lansdowne RoadShieldsboroughMI
Tillman - Jacobi57918 Gwendolyn CirclesSheridanportMI
Connelly, Feest and Hodkiewicz7057 Stanley RoadKearaburghCA
Shanahan, Robel and Beier378 Berta CrescentWest GerryKS
Kling - McLaughlin8346 Kertzmann SquareSouth JoesphID
Jogi - McLaughlin83462 Shazam StreetNorth JoesphID
Jogi - McLaughlin83462 Shazam StreetNorth JoesphID
No records

Here’s the code for the example above:

const { showContextMenu } = useContextMenu();
const isTouch = useMediaQuery('(pointer: coarse)');

return (
  <DataTable
    withTableBorder
    withColumnBorders
    textSelectionDisabled={isTouch} // 👈 disable text selection on touch devices
    columns={[{ accessor: 'name' }, { accessor: 'streetAddress' }, { accessor: 'city' }, { accessor: 'state' }]}
    records={companies}
    onRowContextMenu={({ record, event }) =>
      showContextMenu([
        // row context menu items...
      ])(event)
    }
    onCellContextMenu={({ record, column, event }) => {
      if (column.accessor === 'name') {
        return showContextMenu([
          // 'name' cell context menu items...
        ])(event);
      }
    }}
  />
);

Showing a context-menu on left-click

Usually, context-menus are shown when the user right-clicks on a user interface element. However, you can also show a context-menu when the user left-clicks on a row or cell by using the onRowClick and onCellClick properties instead of onRowContextMenu and onCellContextMenu. Here’s an example:

Name
Street address
City
State
Feest, Bogan and Herzog21716 Ratke DriveStromanportWY
Cummerata - Kuhlman6389 Dicki StreamSouth GateNH
Goyette Inc8873 Mertz RapidDorthysideID
Runte Inc2996 Ronny MountMcAllenMA
Goldner, Rohan and Lehner632 Broadway AvenueNorth LouieWY
Doyle, Hodkiewicz and O'Connell576 Joyce WaysTyraburghKS
Rau - O'Hara7508 Lansdowne RoadShieldsboroughMI
Tillman - Jacobi57918 Gwendolyn CirclesSheridanportMI
Connelly, Feest and Hodkiewicz7057 Stanley RoadKearaburghCA
Shanahan, Robel and Beier378 Berta CrescentWest GerryKS
Kling - McLaughlin8346 Kertzmann SquareSouth JoesphID
Jogi - McLaughlin83462 Shazam StreetNorth JoesphID
Jogi - McLaughlin83462 Shazam StreetNorth JoesphID
No records

Here’s the code for the example above:

const { showContextMenu } = useContextMenu();
const isTouch = useMediaQuery('(pointer: coarse)');

return (
  <DataTable
    withTableBorder
    withColumnBorders
    textSelectionDisabled={isTouch} // 👈 disable text selection on touch devices
    columns={[{ accessor: 'name' }, { accessor: 'streetAddress' }, { accessor: 'city' }, { accessor: 'state' }]}
    records={companies}
    // 👇 use `onRowClick` instead of `onRowContextMenu` to
    //    show context-menu when the user clicks on a row
    onRowClick={({ record, event }) =>
      showContextMenu([
        // context menu items...
      ])(event)
    }
  />
);

Using context-menus inside modals

You can use context-menus inside modals. In the example below, we’re showing a context-menu when the user right-clicks on a table row rendered inside a modal:

Here’s the code for the example above:

const { showContextMenu } = useContextMenu();
const isTouch = useMediaQuery('(pointer: coarse)');

return (
  <Button
    leftSection={<IconAppWindow size={16} />}
    onClick={() =>
      modals.open({
        centered: true,
        title: 'Right-click on a row',
        children: (
          <DataTable
            borderRadius="sm"
            height={260}
            withTableBorder
            withColumnBorders
            textSelectionDisabled={isTouch} // 👈 disable text selection on touch devices
            columns={[{ accessor: 'name' }, { accessor: 'city' }, { accessor: 'state', textAlign: 'right' }]}
            records={companies}
            onRowContextMenu={({ record, event }) =>
              showContextMenu([
                // context menu items...
              ])(event)
            }
          />
        ),
      })
    }
  >
    Open modal
  </Button>
);

Head over to the next example to discover more features of Mantine DataTable.