Skip to content

Commit 025f4b4

Browse files
rsbhclaude
andauthored
fix: fit tables within content width (#96)
* fix: use display table to fit columns within content width Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: table-layout fixed with cell wrap and top alignment Override Apsara cell overflow/nowrap to allow multiline content. Add wide table example for testing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e871b02 commit 025f4b4

3 files changed

Lines changed: 34 additions & 5 deletions

File tree

examples/basic/content/docs/index.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,17 @@ chronicle dev
104104
| email | string | Email address |
105105
| active | bool | Account status |
106106

107+
### Wide Table
108+
109+
| Name | Type | Default | Required | Description | Example | Notes |
110+
|------|------|---------|----------|-------------|---------|-------|
111+
| id | number | auto | yes | Unique identifier for the resource | 42 | Auto-incremented |
112+
| name | string | none | yes | Lorem ipsum dolor sit amet, consectetur adipiscing elit sed do eiusmod tempor | John Doe | Must be unique across all tenants in the system |
113+
| email | string | none | yes | Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip | john@example.com | Validated against RFC 5322 format specification |
114+
| role | string | viewer | no | Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat | admin | One of: admin, editor, viewer, guest, superadmin |
115+
| created_at | datetime | now | no | Excepteur sint occaecat cupidatat non proident sunt in culpa qui officia deserunt | 2024-01-15T10:30:00Z | ISO 8601 format with timezone offset required |
116+
| metadata | object | empty | no | Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque | key-value pairs | Max 10 keys allowed per resource entity |
117+
107118
## Horizontal Rule
108119

109120
---

packages/chronicle/src/themes/default/Page.module.css

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,21 @@
104104
}
105105

106106
.content table {
107-
display: block;
108-
max-width: 100%;
109-
overflow-x: auto;
107+
display: table;
108+
table-layout: fixed;
109+
width: 100%;
110110
margin-bottom: var(--rs-space-5);
111111
}
112112

113+
.content table td,
114+
.content table th {
115+
overflow: visible;
116+
white-space: normal;
117+
text-overflow: unset;
118+
word-wrap: break-word;
119+
vertical-align: top;
120+
}
121+
113122
.content details {
114123
border: 1px solid var(--rs-color-border-base-primary);
115124
border-radius: var(--rs-radius-2);

packages/chronicle/src/themes/paper/Page.module.css

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,21 @@
200200
}
201201

202202
.content table {
203-
display: block;
203+
display: table;
204+
table-layout: fixed;
204205
width: 100%;
205-
overflow-x: auto;
206206
margin-bottom: var(--rs-space-5);
207207
}
208208

209+
.content table td,
210+
.content table th {
211+
overflow: visible;
212+
white-space: normal;
213+
text-overflow: unset;
214+
word-wrap: break-word;
215+
vertical-align: top;
216+
}
217+
209218
.content a {
210219
font-size: inherit;
211220
}

0 commit comments

Comments
 (0)