How to create a field macro similar to the tag macro

\define filter-pill(pill_filter pill_label:"FilterPill Label" pillcolour:lightgrey textcolour:#333333 id)
<$let popupID=<<qualify """$:/temp/state/$pill_label$$id$""">>>
<$button dragFilter="$pill_filter$" class="tc-tag-label tc-btn-invisible" style="background-color:$pillcolour$; color:$textcolour$;" popup=<<popupID>> >$pill_label$
</$button>
<$reveal type="popup" state=<<popupID>> >
<div class="tc-drop-down">
<$button> export
<$action-sendmessage $message="tm-download-file"
   $param="$:/core/templates/exporters/JsonFile"
   exportFilter="$pill_filter$"
   filename="tiddlers.json" /> 
</$button>
<hr>
{{{$pill_filter$}}}
</div>
</$reveal>
\end

It’s working now. Thank you @EricShulman - https://focus-tiddler-demo.tiddlyhost.com/#tag-field%20macro