Manual:NamespaceInputWidget

NamespaceInputWidget is a Namespace input widget which is used to select a wiki namespace. It is based on OOUI's DropdownInputWidget. but provide wiki namespace as options.

Javasciprt Examples

 * In MediaWiki Extension

To use the widget in UserScript is very easy, You just need to load the dependencie by mw.loader.using. and put the code into the block. Try the below code in your Special:MyPage/common.js
 * In UserScript

To use in gadgets, you have to add a mediawiki.widgets entry in the  field of gadget description. See Gadgets' documentation for instructions and examples.
 * In Gadget
 * So Add dependencies in MediaWiki:Gadgets-definition
 * Create MediaWiki:Gadget-mygadget.js page with code. You does not need to use mw.loader.using as we did in UserScript.

PHP
To use NamespaceInputWidget in MediaWiki Extension's Special Page. You need to decleare the use of MediaWiki\Widget\NamespaceInputWidget. And have to enable OOUI in SpecialPage.