I want to have an asset field which only allows .svgs.

To be more specific, I want to upload icons I can later import in my templates via the svg() command. Is this possible without any plugins or a custom field?


You can achieve this using the extraFileKinds config setting like this:

'extraFileKinds' => [
    'svg' => [
        'label' => 'SVG',
        'extensions' => ['svg'],

On your Asset field, check the "Restrict allowed file types?" checkbox, and select "SVG" from the list.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.