Skip to content

Commit 7f5b7f6

Browse files
scott graysonscott grayson
authored andcommitted
feat: add custom CSS styling for library item icons
- Add custom CSS class 'library-item-name-column' to name column - Create filament-library.css with custom styling - Make both folder and document icons darker gray (gray-600) - Add proper spacing between icons and text (0.75rem gap + 0.5rem margin) - Update service provider to register custom CSS asset
1 parent 1012e3f commit 7f5b7f6

3 files changed

Lines changed: 27 additions & 6 deletions

File tree

resources/css/filament-library.css

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/* Filament Library Plugin Styles */
2+
3+
/* Library item name column styling */
4+
.library-item-name-column {
5+
display: flex;
6+
align-items: center;
7+
gap: 0.75rem; /* 12px - more spacing than gap-2 (8px) */
8+
}
9+
10+
/* Make icons darker gray */
11+
.library-item-name-column .fi-icon {
12+
color: rgb(75 85 99) !important; /* gray-600 - darker than default gray */
13+
}
14+
15+
/* Ensure proper spacing between icon and text */
16+
.library-item-name-column .fi-icon {
17+
margin-right: 0.5rem; /* 8px additional spacing */
18+
}

src/FilamentLibraryServiceProvider.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,14 @@ protected function getAssets(): array
100100
{
101101
$assets = [];
102102

103-
// Only register assets if they exist
103+
// Register our custom CSS file
104+
if (file_exists(__DIR__ . '/../resources/css/filament-library.css')) {
105+
$assets[] = Css::make('filament-library-styles', __DIR__ . '/../resources/css/filament-library.css');
106+
}
107+
108+
// Only register dist assets if they exist
104109
if (file_exists(__DIR__ . '/../resources/dist/filament-library.css')) {
105-
$assets[] = Css::make('filament-library-styles', __DIR__ . '/../resources/dist/filament-library.css');
110+
$assets[] = Css::make('filament-library-dist-styles', __DIR__ . '/../resources/dist/filament-library.css');
106111
}
107112

108113
if (file_exists(__DIR__ . '/../resources/dist/filament-library.js')) {

src/Resources/LibraryItemResource.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,9 @@ public static function table(Table $table): Table
9595
->icon(fn (LibraryItem $record): string =>
9696
$record->type === 'folder' ? 'heroicon-o-folder' : 'heroicon-o-document'
9797
)
98-
->iconColor(fn (LibraryItem $record): string =>
99-
$record->type === 'folder' ? 'success' : 'gray'
100-
)
98+
->iconColor('gray')
10199
->iconPosition('before')
102-
->extraAttributes(['class' => 'flex items-center gap-2']),
100+
->extraAttributes(['class' => 'library-item-name-column']),
103101
Tables\Columns\TextColumn::make('creator.name')
104102
->label('Created By')
105103
->searchable()

0 commit comments

Comments
 (0)