Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

refactor(templates): the file explorer scrolls its columns with Stack props, not custom CSS (#10421)

Cindy Zhang61e6c96bf943
diff --git a/.changeset/file-explorer-stack-props.md b/.changeset/file-explorer-stack-props.md
new file mode 100644
index 0000000000..a2e89336b2
--- /dev/null
+++ b/.changeset/file-explorer-stack-props.md
@@ -0,0 +1,7 @@
+---
+'@astryxdesign/cli': patch
+---
+
+[docs] The File Explorer page template scrolls its columns with `StackItem` and `HStack` `isScrollable` instead of custom overflow and flex styles, and names each column after the folder it lists while the column scrolls. Its chevrons now mirror in right-to-left, and a detail pane scrolled to its end keeps its bottom padding.
+
+@cixzhang
diff --git a/packages/cli/assets/templates/pages/file-explorer/page.tsx b/packages/cli/assets/templates/pages/file-explorer/page.tsx
index 4923267847..b0d20d47f3 100644
--- a/packages/cli/assets/templates/pages/file-explorer/page.tsx
+++ b/packages/cli/assets/templates/pages/file-explorer/page.tsx
@@ -7,6 +7,8 @@ import {Layout, LayoutContent} from '@astryxdesign/core/Layout';
import {Toolbar} from '@astryxdesign/core/Toolbar';
import {List, ListItem} from '@astryxdesign/core/List';
import {HStack, VStack} from '@astryxdesign/core/Layout';
+import {StackItem} from '@astryxdesign/core/Stack';
+import {rtlStyles} from '@astryxdesign/core/utils';
import {Text} from '@astryxdesign/core/Text';
import {Icon} from '@astryxdesign/core/Icon';
import {IconButton} from '@astryxdesign/core/IconButton';
@@ -260,14 +262,9 @@ const FILESYSTEM: FileSystemItem[] = [
];
const page: CSSProperties = {height: '100dvh'};
-const columnRow: CSSProperties = {overflowX: 'auto', overflowY: 'hidden'};
-const scrollable: CSSProperties = {overflowY: 'auto'};
-const fixedColumn: CSSProperties = {flexShrink: 0};
-const detailColumn: CSSProperties = {
- flexGrow: 1,
- flexShrink: 0,
- flexBasis: 320,
-};
+// The detail column fills the rest of the row but never narrows below 320px;
+// past that, the row scrolls sideways.
+const detailFloor: CSSProperties = {flexShrink: 0, flexBasis: 320};
function findItem(items: FileSystemItem[], id: string): FileSystemItem | null {
for (const item of items) {
@@ -361,7 +358,13 @@ export default function FileExplorerPage() {
<IconButton
variant="ghost"
size="sm"
- icon={<Icon icon={ChevronLeftIcon} size="sm" />}
+ icon={
+ <Icon
+ icon={ChevronLeftIcon}
+ size="sm"
+ xstyle={rtlStyles.mirror}
+ />
+ }
onClick={() => {
if (selectedPath.length > 0) {
setSelectedPath(selectedPath.slice(0, -1));
@@ -373,7 +376,13 @@ export default function FileExplorerPage() {
<IconButton
variant="ghost"
size="sm"
- icon={<Icon icon={ChevronRightIcon} size="sm" />}
+ icon={
+ <Icon
+ icon={ChevronRightIcon}
+ size="sm"
+ xstyle={rtlStyles.mirror}
+ />
+ }
isDisabled
label="Go forward"
/>
@@ -449,86 +458,101 @@ export default function FileExplorerPage() {
}
content={
<LayoutContent padding={0} isScrollable={false}>
- <HStack height="100%" style={columnRow}>
+ <HStack height="100%" isScrollable>
{columns.map((col, colIndex) => {
const showDivider =
colIndex < columns.length - 1 || selectedFile != null;
return (
- <Section
+ <StackItem
key={colIndex}
- width={240}
- padding={2}
- variant="transparent"
- dividers={showDivider ? ['end'] : undefined}
- style={{...scrollable, ...fixedColumn}}>
- <List density="compact" hasDividers={false}>
- {col.items.map(item => {
- const isSelected = col.selectedId === item.id;
- const hasChildren =
- item.type === 'folder' &&
- item.children != null &&
- item.children.length > 0;
- return (
- <ListItem
- key={item.id}
- label={item.name}
- startContent={
- <Icon
- icon={
- item.type === 'folder'
- ? FolderIcon
- : DocumentIcon
- }
- color={
- item.type === 'folder' ? 'accent' : 'secondary'
- }
- size="sm"
- />
- }
- endContent={
- hasChildren ? (
+ size="static"
+ isScrollable
+ aria-label={
+ colIndex === 0
+ ? 'Home'
+ : findItem(FILESYSTEM, selectedPath[colIndex - 1])?.name
+ }>
+ <Section
+ width={240}
+ height="100%"
+ padding={2}
+ variant="transparent"
+ dividers={showDivider ? ['end'] : undefined}>
+ <List density="compact" hasDividers={false}>
+ {col.items.map(item => {
+ const isSelected = col.selectedId === item.id;
+ const hasChildren =
+ item.type === 'folder' &&
+ item.children != null &&
+ item.children.length > 0;
+ return (
+ <ListItem
+ key={item.id}
+ label={item.name}
+ startContent={
<Icon
- icon={ChevronRightIcon}
- size="xsm"
- color="secondary"
+ icon={
+ item.type === 'folder'
+ ? FolderIcon
+ : DocumentIcon
+ }
+ color={
+ item.type === 'folder'
+ ? 'accent'
+ : 'secondary'
+ }
+ size="sm"
/>
- ) : undefined
- }
- onClick={() => handleSelect(colIndex, item.id)}
- isSelected={isSelected}
- />
- );
- })}
- </List>
- </Section>
+ }
+ endContent={
+ hasChildren ? (
+ <Icon
+ icon={ChevronRightIcon}
+ size="xsm"
+ color="secondary"
+ xstyle={rtlStyles.mirror}
+ />
+ ) : undefined
+ }
+ onClick={() => handleSelect(colIndex, item.id)}
+ isSelected={isSelected}
+ />
+ );
+ })}
+ </List>
+ </Section>
+ </StackItem>
);
})}
{selectedFile && (
- <Section
- padding={6}
- variant="transparent"
- style={{...scrollable, ...detailColumn}}>
- <VStack gap={4} hAlign="center">
- <Avatar name={selectedFile.name} size={96} />
- <VStack gap={1} hAlign="center">
- <Text type="label">{selectedFile.name}</Text>
- <Text type="supporting">
- {getFileExtension(selectedFile.name)} Document
- </Text>
+ <StackItem
+ size="fill"
+ isScrollable
+ aria-label={selectedFile.name}
+ style={detailFloor}>
+ <Section padding={6} variant="transparent">
+ <VStack gap={4} hAlign="center">
+ <Avatar name={selectedFile.name} size={96} />
+ <VStack gap={1} hAlign="center">
+ <Text type="label">{selectedFile.name}</Text>
+ <Text type="supporting">
+ {getFileExtension(selectedFile.name)} Document
+ </Text>
+ </VStack>
+ <MetadataList title="Information">
+ <MetadataListItem label="Created">
+ March 28, 2026 at 2:15 PM
+ </MetadataListItem>
+ <MetadataListItem label="Modified">
+ Yesterday, 10:27 PM
+ </MetadataListItem>
+ <MetadataListItem label="Kind">
+ {getFileExtension(selectedFile.name)} Document
+ </MetadataListItem>
+ </MetadataList>
</VStack>
- <MetadataList title="Information">
- <MetadataListItem label="Created">
- March 28, 2026 at 2:15 PM
- </MetadataListItem>
- <MetadataListItem label="Modified">
- Yesterday, 10:27 PM
- </MetadataListItem>
- <MetadataListItem label="Kind">
- {getFileExtension(selectedFile.name)} Document
- </MetadataListItem>
- </MetadataList>
- </VStack>
- </Section>
+ </Section>
+ </StackItem>
)}
</HStack>
</LayoutContent>