Skip to content

Commit bbd7f14

Browse files
author
James Kolce
committed
[fix: #149] Add a truncate class for table cells
1 parent 45cd278 commit bbd7f14

4 files changed

Lines changed: 56 additions & 1 deletion

File tree

‎dist/concise.css‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -918,6 +918,13 @@ table {
918918
.table--hoverCell tbody td:hover {
919919
background-color: #f5f5f5; }
920920

921+
.table--truncate {
922+
table-layout: fixed; }
923+
.table--truncate td {
924+
overflow: hidden;
925+
text-overflow: ellipsis;
926+
white-space: nowrap; }
927+
921928
i,
922929
em,
923930
.italic {

‎dist/concise.min.css‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/core/layout/_tables.scss‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,14 @@ table {
156156
.table--hoverCell {
157157
tbody td:hover { background-color: getColor(background, light); }
158158
}
159+
160+
// Truncate table
161+
.table--truncate {
162+
table-layout: fixed;
163+
164+
td {
165+
overflow: hidden;
166+
text-overflow: ellipsis;
167+
white-space: nowrap;
168+
}
169+
}

‎test/test.html‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
text-align: center;
2020
width: 100%;
2121
}
22+
23+
.table--truncate,
24+
.table--truncate td {
25+
width: 500px;
26+
}
2227
</style>
2328
</head>
2429

@@ -345,6 +350,38 @@ <h6>Heading 6 <small>Helper text</small></h6>
345350
</tbody>
346351
</table>
347352

353+
<table class="table--truncate">
354+
<thead>
355+
<tr>
356+
<th scope="col">#</th>
357+
<th scope="col">First Name</th>
358+
<th scope="col">Last Name</th>
359+
</tr>
360+
</thead>
361+
362+
<tfoot>
363+
<tr>
364+
<td><strong>Total Users:</strong></td>
365+
<td>2</td>
366+
<td></td>
367+
</tr>
368+
</tfoot>
369+
370+
<tbody>
371+
<tr>
372+
<td>1</td>
373+
<td title="This is a long long long long long long long long text">This is a long long long long long long long long text</td>
374+
<td>Doe</td>
375+
</tr>
376+
377+
<tr>
378+
<td>2</td>
379+
<td>Jane</td>
380+
<td>Doe</td>
381+
</tr>
382+
</tbody>
383+
</table>
384+
348385
<div class="table--responsive">
349386
<table class="table--full">
350387
<thead>

0 commit comments

Comments
 (0)