Skip to content

Allow icon() to work with empty namespace and/or prefix#430

Merged
ADmad merged 2 commits intomasterfrom
feature/icon-optional-namespace-prefix
Feb 19, 2026
Merged

Allow icon() to work with empty namespace and/or prefix#430
ADmad merged 2 commits intomasterfrom
feature/icon-optional-namespace-prefix

Conversation

@dereuromark
Copy link
Member

Summary

  • Makes namespace optional - null/empty values are now properly omitted instead of adding extra spaces
  • Makes prefix optional - when null/empty, uses just the icon name without a prefix-dash

This allows using icon sets like Remixicon that don't use a namespace:

// Before: produced <i class="  ri-home-line"></i> (extra spaces)
// After: produces <i class="ri-home-line"></i>
$this->Html->icon('home-line', ['prefix' => 'ri', 'namespace' => null]);

Also supports hypothetical icon sets using just the icon name:

// Produces <icon class="home"></icon>
$this->Html->icon('home', ['tag' => 'icon', 'namespace' => null, 'prefix' => null]);

Fixes #429

dereuromark and others added 2 commits February 19, 2026 16:29
Icon sets like Remixicon don't use a namespace class. Setting
namespace to null or empty string previously resulted in extra
spaces in the generated class attribute.

This change makes both namespace and prefix optional:
- Null/empty namespace is now properly omitted
- Null/empty prefix uses just the icon name without a prefix

Fixes #429
@ADmad ADmad merged commit bc86237 into master Feb 19, 2026
5 checks passed
@ADmad ADmad deleted the feature/icon-optional-namespace-prefix branch February 19, 2026 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Icon set without namespace

2 participants