def METHOD_NAME(self, socket, context, layout):
    if not self.show_limits:
        r = layout.row(align=True)
        r.prop(self, 'selected_mode', expand=True)
        r.prop(self, 'show_limits', icon='SETTINGS', text='')
    else:
        c = layout.column(align=True)
        kind = self.selected_mode
        c.prop(self, kind + '_min', text='min')
        c.prop(self, kind + '_max', text='max')
        c = layout.column()
        c.prop(self, 'show_limits', icon='SETTINGS', text='')