Get selected record IDs for custom added admin button

how to use this in custom button components? can you show me the full code?