# Table - Sorting

##### Back to Table Component Documentation

The sorting feature allows users to sort the records displayed in the table by clicking on the column headers. This is enabled by setting the `enable-sorting="true"` attribute.

Once enabled the user can sort the records by clicking on the fields.

    <k-table id="sortingExample" enable-sorting="true"></k-table>
    <script type="module">
      document.getElementById('sortingExample').setRecords(contacts);
    </script>