Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Select com uma lista de todos os estados brasileiros.
<select name="estados-brasil">
<option value="AC">Acre</option>
<option value="AL">Alagoas</option>
<option value="AP">Amapá</option>
<option value="AM">Amazonas</option>
<option value="BA">Bahia</option>
<option value="CE">Ceará</option>
<option value="DF">Distrito Federal</option>
<option value="ES">Espírito Santo</option>
<option value="GO">Goiás</option>
<option value="MA">Maranhão</option>
<option value="MT">Mato Grosso</option>
<option value="MS">Mato Grosso do Sul</option>
<option value="MG">Minas Gerais</option>
<option value="PA">Pará</option>
<option value="PB">Paraíba</option>
<option value="PR">Paraná</option>
<option value="PE">Pernambuco</option>
<option value="PI">Piauí</option>
<option value="RJ">Rio de Janeiro</option>
<option value="RN">Rio Grande do Norte</option>
<option value="RS">Rio Grande do Sul</option>
<option value="RO">Rondônia</option>
<option value="RR">Roraima</option>
<option value="SC">Santa Catarina</option>
<option value="SP">São Paulo</option>
<option value="SE">Sergipe</option>
<option value="TO">Tocantins</option>
</select>
@yuripramos

This comment has been minimized.

Copy link

@yuripramos yuripramos commented Oct 10, 2016

Obrigado, me poupou o cornoJob! kkkk

@heitoralthmann

This comment has been minimized.

Copy link

@heitoralthmann heitoralthmann commented Oct 27, 2016

Obrigado! :)

@thcborges

This comment has been minimized.

Copy link

@thcborges thcborges commented Nov 12, 2016

Muito obrigado!!

@Leomhl

This comment has been minimized.

Copy link

@Leomhl Leomhl commented Dec 29, 2016

Extremamente útil!

@cscholles

This comment has been minimized.

Copy link

@cscholles cscholles commented Dec 29, 2016

obrigada! 👍

@natan88

This comment has been minimized.

Copy link

@natan88 natan88 commented Jan 3, 2017

Valeu! Coisa simples que ajuda os preguiçosos, kkk

@william-keller

This comment has been minimized.

Copy link

@william-keller william-keller commented Jan 23, 2017

valeu, Obrigado!

@jsvini

This comment has been minimized.

Copy link

@jsvini jsvini commented Jan 30, 2017

the lazy ones thank you

@antenando

This comment has been minimized.

Copy link

@antenando antenando commented Feb 8, 2017

parabéns, tá ótemo

@fernandobhz

This comment has been minimized.

Copy link

@fernandobhz fernandobhz commented Mar 15, 2017

value

@gksilva

This comment has been minimized.

Copy link

@gksilva gksilva commented Mar 23, 2017

Valeu!

@woxpeso

This comment has been minimized.

Copy link

@woxpeso woxpeso commented Mar 24, 2017

Valeu :D

@wilianuhlmann

This comment has been minimized.

Copy link

@wilianuhlmann wilianuhlmann commented Mar 29, 2017

Obrigado!

@gabrielmancini

This comment has been minimized.

Copy link

@gabrielmancini gabrielmancini commented Apr 21, 2017

vlw

@sunictec

This comment has been minimized.

Copy link

@sunictec sunictec commented May 2, 2017

Te amo

@kessejones

This comment has been minimized.

Copy link

@kessejones kessejones commented May 18, 2017

Muito Bom!

@tabitaaet

This comment has been minimized.

Copy link

@tabitaaet tabitaaet commented May 26, 2017

Obrigada!

@osouzajefferson

This comment has been minimized.

Copy link

@osouzajefferson osouzajefferson commented Jun 21, 2017

Nossa, valeu muito!

@hevertoncastro

This comment has been minimized.

Copy link

@hevertoncastro hevertoncastro commented Jul 4, 2017

Ajudou bem! 👍

@harissonmatos

This comment has been minimized.

Copy link

@harissonmatos harissonmatos commented Jul 6, 2017

Obrigado

@fontesmarcio

This comment has been minimized.

Copy link

@fontesmarcio fontesmarcio commented Jul 12, 2017

Obrigado

@AllanPinheiroDeLima

This comment has been minimized.

Copy link

@AllanPinheiroDeLima AllanPinheiroDeLima commented Jul 12, 2017

Estrelinha pela ajuda, mano

@devrsantos

This comment has been minimized.

Copy link

@devrsantos devrsantos commented Jul 21, 2017

Valew

@Andreolle

This comment has been minimized.

Copy link

@Andreolle Andreolle commented Aug 9, 2017

Valeuuuuuu!!!
Mó mão na roda! 👍

@Reifefe

This comment has been minimized.

Copy link

@Reifefe Reifefe commented Aug 17, 2017

Perfeito! Obrigado.

@jozadaquebatista

This comment has been minimized.

Copy link

@jozadaquebatista jozadaquebatista commented Aug 27, 2017

Você nem faz ideia de quanto esse pedaço de código me ajudou rsrs obrigado

@bdmedeiros

This comment has been minimized.

Copy link

@bdmedeiros bdmedeiros commented Aug 30, 2017

Valeu, me poupou tempo ... haha

@CViniciusSDias

This comment has been minimized.

Copy link

@CViniciusSDias CViniciusSDias commented Sep 5, 2017

Nem todo herói usa capa.

@kkassia

This comment has been minimized.

Copy link

@kkassia kkassia commented Sep 9, 2017

Obrigada

@nanduzz

This comment has been minimized.

Copy link

@nanduzz nanduzz commented Sep 12, 2017

Obrigado :)

@tkrempser

This comment has been minimized.

Copy link

@tkrempser tkrempser commented Sep 13, 2017

Obrigado!

@oHervis

This comment has been minimized.

Copy link

@oHervis oHervis commented Sep 27, 2017

Shooow, valeu!!!

@nataliaalves03

This comment has been minimized.

Copy link

@nataliaalves03 nataliaalves03 commented Oct 8, 2017

Valeu! :D

@Gawiga

This comment has been minimized.

Copy link

@Gawiga Gawiga commented Oct 14, 2017

contribuindo para preguiça alheia, só exibindo as UF

                                    <select name="estados-brasil">
                                        <option value="AC">AC</option>
                                        <option value="AL">AL</option>
                                        <option value="AP">AP</option>
                                        <option value="AM">AM</option>
                                        <option value="BA">BA</option>
                                        <option value="CE">CE</option>
                                        <option value="DF">DF</option>
                                        <option value="ES">ES</option>
                                        <option value="GO">GO</option>
                                        <option value="MA">MA</option>
                                        <option value="MT">MT</option>
                                        <option value="MS">MS</option>
                                        <option value="MG">MG</option>
                                        <option value="PA">PA</option>
                                        <option value="PB">PB</option>
                                        <option value="PR">PR</option>
                                        <option value="PE">PE</option>
                                        <option value="PI">PI</option>
                                        <option value="RJ">RJ</option>
                                        <option value="RN">RN</option>
                                        <option value="RS">RS</option>
                                        <option value="RO">RO</option>
                                        <option value="RR">RR</option>
                                        <option value="SC">SC</option>
                                        <option value="SP">SP</option>
                                        <option value="SE">SE</option>
                                        <option value="TO">TO</option>
                                    </select>
@wellalencarweb

This comment has been minimized.

Copy link

@wellalencarweb wellalencarweb commented Oct 23, 2017

`<?php
// Para quem quiser...Segue melhorias Gerando Dinamicamnete com PHP

// Gerando Seletor e Trazendo a Opção escolhida Dinamicamente com PHP HTML
// Gera os options (Caso tenha um estado como parâmetro irá trazê-lo selecionado)

function geraUF($myUF = "")
{
$options = " <select name="estadosBrasileiros ">
<option value="">Selecione";

	$estadosBrasileiros = array(
									'AC'=>'Acre',
									'AL'=>'Alagoas',
									'AP'=>'Amapá',
									'AM'=>'Amazonas',
									'BA'=>'Bahia',
									'CE'=>'Ceará',
									'DF'=>'Distrito Federal',
									'ES'=>'Espírito Santo',
									'GO'=>'Goiás',
									'MA'=>'Maranhão',
									'MT'=>'Mato Grosso',
									'MS'=>'Mato Grosso do Sul',
									'MG'=>'Minas Gerais',
									'PA'=>'Pará',
									'PB'=>'Paraíba',
									'PR'=>'Paraná',
									'PE'=>'Pernambuco',
									'PI'=>'Piauí',
									'RJ'=>'Rio de Janeiro',
									'RN'=>'Rio Grande do Norte',
									'RS'=>'Rio Grande do Sul',
									'RO'=>'Rondônia',
									'RR'=>'Roraima',
									'SC'=>'Santa Catarina',
									'SP'=>'São Paulo',
									'SE'=>'Sergipe',
									'TO'=>'Tocantins'
								);
	foreach ($estadosBrasileiros as $uf => $estado) {
		$selected  = $uf == $myUF ?"selected":"";
		$options  .= "<option $selected value=\"$uf\">$estado</option>";
	}

	$options .= "</select>"; 
	
	return $options;
}

// Chamada da Função
echo geraUF('SP');

?>`

@2madera

This comment has been minimized.

Copy link

@2madera 2madera commented Oct 26, 2017

React Native

<Picker  selectedValue={this.state.addressState} onValueChange={(itemValue, itemIndex) => this.setState({addressState: itemValue})}>
                        <Picker.Item label="Acre" value="AC" />
                        <Picker.Item label="Alagoas" value="AL" />
                        <Picker.Item label="Amapá" value="AP" />
                        <Picker.Item label="Amazonas" value="AM" />
                        <Picker.Item label="Bahia" value="BA" />
                        <Picker.Item label="Ceará" value="CE" />
                        <Picker.Item label="Distrito Federal" value="DF" />
                        <Picker.Item label="Espírito Santo" value="ES" />
                        <Picker.Item label="Goiás" value="GO" />
                        <Picker.Item label="Maranhão" value="MA" />
                        <Picker.Item label="Mato Grosso" value="MT" />
                        <Picker.Item label="Mato Grosso do Sul" value="MS" />
                        <Picker.Item label="Minas Gerais" value="MG" />
                        <Picker.Item label="Pará" value="PA" />
                        <Picker.Item label="Paraíba" value="PB" />
                        <Picker.Item label="Paraná" value="PR" />
                        <Picker.Item label="Pernambuco" value="PE" />
                        <Picker.Item label="Piauí" value="PI" />
                        <Picker.Item label="Rio de Janeiro" value="RJ" />
                        <Picker.Item label="Rio Grande do Norte" value="RN" />
                        <Picker.Item label="Rio Grande do Sul" value="RS" />
                        <Picker.Item label="Rondônia" value="RO" />
                        <Picker.Item label="Roraima" value="RR" />
                        <Picker.Item label="Santa Catarina" value="SC" />
                        <Picker.Item label="São Paulo" value="SP" />
                        <Picker.Item label="Sergipe" value="SE" />
                        <Picker.Item label="Tocantins" value="TO" />
                    </Picker>
@marcello-telles

This comment has been minimized.

Copy link

@marcello-telles marcello-telles commented Oct 31, 2017

Nice mlk!

@mtonet

This comment has been minimized.

Copy link

@mtonet mtonet commented Nov 17, 2017

Valeu !

@srRodolfo

This comment has been minimized.

Copy link

@srRodolfo srRodolfo commented Nov 27, 2017

Obrigado!

@wermerson

This comment has been minimized.

Copy link

@wermerson wermerson commented Nov 29, 2017

Obrigado!

@HenriqueMarcelo

This comment has been minimized.

Copy link

@HenriqueMarcelo HenriqueMarcelo commented Dec 5, 2017

Obrigado

@obernardocosta

This comment has been minimized.

Copy link

@obernardocosta obernardocosta commented Dec 13, 2017

Parabéns pela iniciativa, obrigado!

@giovannipds

This comment has been minimized.

Copy link

@giovannipds giovannipds commented Dec 18, 2017

Preguiça, preguiça, preguiça:

<label class="sr-only" for="state"><abbr title="Unidade Federativa">UF</abbr></label>
<select class="form-control" id="state" name="state">
    <option>UF</option>
    <option title="Acre" value="AL">AC</option>
    <option title="Alagoas" value="AP">AL</option>
    <option title="Amapá" value="AM">AP</option>
    <option title="Amazonas" value="BA">AM</option>
    <option title="Bahia" value="CE">BA</option>
    <option title="Ceará" value="DF">CE</option>
    <option title="Distrito Federal" value="ES">DF</option>
    <option title="Espírito Santo" value="GO">ES</option>
    <option title="Goiás" value="MA">GO</option>
    <option title="Maranhão" value="MT">MA</option>
    <option title="Mato Grosso" value="MS">MT</option>
    <option title="Mato Grosso do Sul" value="MG">MS</option>
    <option title="Minas Gerais" value="PA">MG</option>
    <option title="Pará" value="PB">PA</option>
    <option title="Paraíba" value="PR">PB</option>
    <option title="Paraná" value="PE">PR</option>
    <option title="Pernambuco" value="PI">PE</option>
    <option title="Piauí" value="RJ">PI</option>
    <option title="Rio de Janeiro" value="RN">RJ</option>
    <option title="Rio Grande do Norte" value="RS">RN</option>
    <option title="Rio Grande do Sul" value="RO">RS</option>
    <option title="Rondônia" value="RR">RO</option>
    <option title="Roraima" value="SC">RR</option>
    <option title="Santa Catarina" value="SP">SC</option>
    <option title="São Paulo" value="SE">SP</option>
    <option title="Sergipe" value="TO">SE</option>
    <option title="Tocantins">TO</option>
</select>
@g4rcez

This comment has been minimized.

Copy link

@g4rcez g4rcez commented Dec 26, 2017

Só complementando, nome dos estados e valores completo

<select name="estados-brasil">
                    <option value="Acre">Acre</option>
                    <option value="Alagoas">Alagoas</option>
                    <option value="Amapá">Amapá</option>
                    <option value="Amazonas">Amazonas</option>
                    <option value="Bahia">Bahia</option>
                    <option value="Ceará">Ceará</option>
                    <option value="Distrito Federal">Distrito Federal</option>
                    <option value="Espírito Santo">Espírito Santo</option>
                    <option value="Goiás">Goiás</option>
                    <option value="Maranhão">Maranhão</option>
                    <option value="Mato Grosso">Mato Grosso</option>
                    <option value="Mato Grosso do Sul">Mato Grosso do Sul</option>
                    <option value="Minas Gerais">Minas Gerais</option>
                    <option value="Pará">Pará</option>
                    <option value="Paraíba">Paraíba</option>
                    <option value="Paraná">Paraná</option>
                    <option value="Pernambuco">Pernambuco</option>
                    <option value="Piauí">Piauí</option>
                    <option value="Rio de Janeiro">Rio de Janeiro</option>
                    <option value="Rio Grande do Norte">Rio Grande do Norte</option>
                    <option value="Rio Grande do Sul">Rio Grande do Sul</option>
                    <option value="Rondônia">Rondônia</option>
                    <option value="Roraima">Roraima</option>
                    <option value="Santa Catarina">Santa Catarina</option>
                    <option value="São Paulo">São Paulo</option>
                    <option value="Sergipe">Sergipe</option>
                    <option value="Tocantins">Tocantins</option>
                </select>
@erikrossetti

This comment has been minimized.

Copy link

@erikrossetti erikrossetti commented Jan 17, 2018

Muito obrigado pessoal!

@danillobarbosa

This comment has been minimized.

Copy link

@danillobarbosa danillobarbosa commented Mar 11, 2018

Vlw!

@regisboliver

This comment has been minimized.

Copy link

@regisboliver regisboliver commented Mar 13, 2018

valeu!

@lipfreitas

This comment has been minimized.

Copy link

@lipfreitas lipfreitas commented Mar 15, 2018

+1 Star

Excelente trabalho!

@theluksteixeira

This comment has been minimized.

Copy link

@theluksteixeira theluksteixeira commented Mar 15, 2018

Obrigado, amigo!

@lipfreitas

This comment has been minimized.

Copy link

@lipfreitas lipfreitas commented Mar 26, 2018

Se eu pudesse dar mais 1 star toda vez que eu preciso usar esse código hasuhasuhush

@jxnata

This comment has been minimized.

Copy link

@jxnata jxnata commented Apr 18, 2018

Merece um beijo

@michaelmeneses

This comment has been minimized.

Copy link

@michaelmeneses michaelmeneses commented Apr 25, 2018

Acre
Alagoas
Amapá
Amazonas
Bahia
Ceará
Distrito Federal
Espírito Santo
Goiás
Maranhão
Mato Grosso
Mato Grosso do Sul
Minas Gerais
Pará
Paraíba
Paraná
Pernambuco
Piauí
Rio de Janeiro
Rio Grande do Norte
Rio Grande do Sul
Rondônia
Roraima
Santa Catarina
São Paulo
Sergipe
Tocantins

@thenrique88

This comment has been minimized.

Copy link

@thenrique88 thenrique88 commented May 17, 2018

Contribuiu para o trabalho preguiça! Isso deveria vir nativo no VS. kkkkkk. Valeu demais.

@rickslayer

This comment has been minimized.

Copy link

@rickslayer rickslayer commented May 30, 2018

em json
[{
"AC":"Acre",
"AL":"Alagoas",
"AP":"Amapá",
"AM":"Amazonas",
"BA":"Bahia",
"CE":"Ceará",
"DF":"Distrito Federal",
"ES":"Espírito Santo",
"GO":"Goiás",
"MA":"Maranhão",
"MT":"Mato Grosso",
"MS":"Mato Grosso do Sul",
"MG":"Minas Gerais",
"PA":"Pará",
"PB":"Paraíba",
"PR":"Paraná",
"PE":"Pernambuco",
"PI":"Piauí",
"RJ":"Rio de Janeiro",
"RN":"Rio Grande do Norte",
"RS":"Rio Grande do Sul",
"RO":"Rondônia",
"RR":"Roraima",
"SC":"Santa Catarina",
"SP":"São Paulo",
"SE":"Sergipe",
"TO":"Tocantins"
}]

@guilhermealveslopes

This comment has been minimized.

Copy link

@guilhermealveslopes guilhermealveslopes commented Jun 10, 2018

Me sinto aliviado por ver que não sou o único preguiçoso.. kkk
Vlw irmão, Abraço!

@marinafaria

This comment has been minimized.

Copy link

@marinafaria marinafaria commented Jun 10, 2018

Muito obrigada, moço! Ajudou demais

@mendesrl

This comment has been minimized.

Copy link

@mendesrl mendesrl commented Jun 18, 2018

Obrigada me ajudou muuuiitto

@setsunaslash

This comment has been minimized.

Copy link

@setsunaslash setsunaslash commented Jun 21, 2018

Muito obrigado! Tava fazendo um exercício enorme aqui e ganhei muito tempo, valeu!

@csvoiptelecom

This comment has been minimized.

Copy link

@csvoiptelecom csvoiptelecom commented Jun 23, 2018

Esta de parabéns!!! Não fica ouvindo esse povo que gosta de ser do contra, esse povo é tão útil como olho mágico pra porta de vidro. E convenhamos......... pqp, ficar digitando um por um, toda vez que precisamos em um site, ou em uma aplicação que seja. Acho que não é preguiça e sim bom senso!!!

@julia0x00f

This comment has been minimized.

Copy link

@julia0x00f julia0x00f commented Jun 27, 2018

O melhor do brasil é esse repo

@guxtavosantana

This comment has been minimized.

Copy link

@guxtavosantana guxtavosantana commented Jul 3, 2018

Valeeu, seu lindo

@Luc45

This comment has been minimized.

Copy link

@Luc45 Luc45 commented Jul 24, 2018

Somente os labels:

<select name="estados" class="form-control">
    <option>Acre</option>
    <option>Alagoas</option>
    <option>Amapá</option>
    <option>Amazonas</option>
    <option>Bahia</option>
    <option>Ceará</option>
    <option>Distrito Federal</option>
    <option>Espírito Santo</option>
    <option>Goiás</option>
    <option>Maranhão</option>
    <option>Mato Grosso</option>
    <option>Mato Grosso do Sul</option>
    <option>Minas Gerais</option>
    <option>Pará</option>
    <option>Paraíba</option>
    <option>Paraná</option>
    <option>Pernambuco</option>
    <option>Piauí</option>
    <option>Rio de Janeiro</option>
    <option>Rio Grande do Norte</option>
    <option>Rio Grande do Sul</option>
    <option>Rondônia</option>
    <option>Roraima</option>
    <option>Santa Catarina</option>
    <option>São Paulo</option>
    <option>Sergipe</option>
    <option>Tocantins</option>
</select>
@leandroblanes

This comment has been minimized.

Copy link

@leandroblanes leandroblanes commented Jul 30, 2018

Em List, no caso eu usei no htmlHelper do mvc

var estados = new List() { "AC", "AL", "AP", "AM", "BA", "CE", "DF", "ES", "GO", "MA", "MT", "MS", "MG", "PA", "PB", "PR", "PE", "PI", "RJ", "RN", "RS", "RO", "RR", "SC", "SP", "SE", "TO" }

@Html.DropDownListFor(m => m.Uf, new SelectList(estados, Model.Uf), "Selecione", new { @Class = "form-control" })

@lucaswx2

This comment has been minimized.

Copy link

@lucaswx2 lucaswx2 commented Jul 30, 2018

<ion-select #UF>  
    <ion-option value="AC">AC</ion-option>\ 
    <ion-option value="AL">AL</ion-option>\ 
    <ion-option value="AP">AP</ion-option>\ 
    <ion-option value="AM">AM</ion-option>\ 
    <ion-option value="BA">BA</ion-option>\ 
    <ion-option value="CE">CE</ion-option>\ 
    <ion-option value="DF">DF</ion-option>\ 
    <ion-option value="ES">ES</ion-option>\ 
    <ion-option value="GO">GO</ion-option>\ 
    <ion-option value="MA">MA</ion-option>\ 
    <ion-option value="MT">MT</ion-option>\ 
    <ion-option value="MS">MS</ion-option>\ 
    <ion-option value="MG">MG</ion-option>\ 
    <ion-option value="PA">PA</ion-option>\ 
    <ion-option value="PB">PB</ion-option>\ 
    <ion-option value="PR">PR</ion-option>\ 
    <ion-option value="PE">PE</ion-option>\ 
    <ion-option value="PI">PI</ion-option>\ 
    <ion-option value="RJ">RJ</ion-option>\ 
    <ion-option value="RN">RN</ion-option>\ 
    <ion-option value="RS">RS</ion-option>\ 
    <ion-option value="RO">RO</ion-option>\ 
    <ion-option value="RR">RR</ion-option>\ 
    <ion-option value="SC">SC</ion-option>\ 
    <ion-option value="SP">SP</ion-option>\ 
    <ion-option value="SE">SE</ion-option>\ 
    <ion-option value="TO">TO</ion-option>\ 
</ion-select>
@pgbs110

This comment has been minimized.

Copy link

@pgbs110 pgbs110 commented Sep 5, 2018

deus te abençoe por isso

@paulokenobi

This comment has been minimized.

Copy link

@paulokenobi paulokenobi commented Sep 5, 2018

@VicenzoMartinelli

This comment has been minimized.

Copy link

@VicenzoMartinelli VicenzoMartinelli commented Oct 1, 2018

isso eu chamo de contribuição pra comunidade

@jeancopati

This comment has been minimized.

Copy link

@jeancopati jeancopati commented Oct 24, 2018

Como eu amo vocês <3

@tiicaa

This comment has been minimized.

Copy link

@tiicaa tiicaa commented Nov 9, 2018

Pessoal, como posso implementar isso no contact form 7?

@carlosnani

This comment has been minimized.

Copy link

@carlosnani carlosnani commented Dec 26, 2018

Obrigado, me ajudou muito.

@mscansian

This comment has been minimized.

Copy link

@mscansian mscansian commented Jan 23, 2019

Valeu! Já garantiu teu lugar no céu.

@C4stro

This comment has been minimized.

Copy link

@C4stro C4stro commented Mar 24, 2019

VAAAAAAAAAAAAAALEW.

@LucasAsafe

This comment has been minimized.

Copy link

@LucasAsafe LucasAsafe commented Apr 10, 2019

Valeu, vaguinha garantida no céu. Economia de tempo garantida

@DaltonDesign

This comment has been minimized.

Copy link

@DaltonDesign DaltonDesign commented Apr 15, 2019

Valeu!
Deus te abençoe!

@heverton100

This comment has been minimized.

Copy link

@heverton100 heverton100 commented Apr 26, 2019

Obrigado!

@ryanalencar

This comment has been minimized.

Copy link

@ryanalencar ryanalencar commented Apr 27, 2019

DEUS!!! kkk

@phsantiago

This comment has been minimized.

Copy link

@phsantiago phsantiago commented Jun 23, 2019

Usando a lib de react-native react-native-modal-dropdown e styled-components:

import ModalDropdown from 'react-native-modal-dropdown';
import styled from 'styled-components/native';

const SelectStyle = styled(ModalDropdown)`
  padding-top: 10;
  padding-bottom: 10;
  border-bottom-width: 1;
  color: #000;
  border-bottom-color: #E0E0E0;
`;

<SelectStyle
  {...inputProps}
  onBlur={input.onBlur}
  onFocus={input.onFocus}
  defaultValue={input.value || input.placeholder}
  textStyle={{ fontSize: 19 }}
  dropdownTextStyle={{ fontSize: 19 }}
  dropdownStyle={{ width: '80%' }}
  onSelect={(index, value) => input.onChange(value)}
  options={['AC', 'AL', 'AP', 'AM', 'BA', 'CE', 'DF', 'ES', 'GO', 'MA', 'MT', 'MS', 'MG', 'PA', 'PB', 'PR', 'PE', 'PI', 'RJ', 'RN', 'RS', 'RO', 'RR', 'SC', 'SP', 'SE', 'TO',]}
/>
@NathanWeber

This comment has been minimized.

Copy link

@NathanWeber NathanWeber commented Sep 8, 2019

Show de bola! Muito obrigado

@DevLeonardoFA

This comment has been minimized.

Copy link

@DevLeonardoFA DevLeonardoFA commented Oct 1, 2019

Muito Obrigado!

@karolramos

This comment has been minimized.

Copy link

@karolramos karolramos commented Nov 14, 2019

valeu <3

@gasharaujo

This comment has been minimized.

Copy link

@gasharaujo gasharaujo commented Jan 4, 2020

Tu é top

@ericfreitas88

This comment has been minimized.

Copy link

@ericfreitas88 ericfreitas88 commented Jan 10, 2020

Muito obrigado.
Me poupou um com tempo.

@dawsompablo

This comment has been minimized.

Copy link

@dawsompablo dawsompablo commented Feb 21, 2020

Agilizou meu trabalho kkk vlwww!

@mahanmashoof

This comment has been minimized.

Copy link

@mahanmashoof mahanmashoof commented Apr 5, 2020

valeu!

@carlosdanielpohlod

This comment has been minimized.

Copy link

@carlosdanielpohlod carlosdanielpohlod commented Apr 16, 2020

humilde, vlw

@italods

This comment has been minimized.

Copy link

@italods italods commented May 10, 2020

Obrigado hahah

@viniciusgomes

This comment has been minimized.

Copy link

@viniciusgomes viniciusgomes commented May 17, 2020

Te Amo! <3

@thiagopetherson

This comment has been minimized.

Copy link

@thiagopetherson thiagopetherson commented May 31, 2020

Obrigado, me poupou o cornoJob! kkkk

kkkkkkkkkkkkkkkkkkkkkk

@itamarsilvacc

This comment has been minimized.

Copy link

@itamarsilvacc itamarsilvacc commented May 31, 2020

Amém!

@Megaomni

This comment has been minimized.

Copy link

@Megaomni Megaomni commented Jul 17, 2020

certeza que com isso você ganhou sua vaga no céu! VLW

@caioalexandre6

This comment has been minimized.

Copy link

@caioalexandre6 caioalexandre6 commented Jul 24, 2020

Pae é brabo, obrigadão!!

@naothomachida

This comment has been minimized.

Copy link

@naothomachida naothomachida commented Aug 15, 2020

ReactJS + MaterialUi

<FormControl>
    <InputLabel id="entregaUF-label">UF</InputLabel>
    <Select
        labelId={isLoading ? <CircularProgress size={20} /> : 'entregaUF-label'}
        id="entregaUF"
        value={entrega.entregaUf}
        onChange={e => setEntrega({ ...entrega, entregaUf: e.target.value })}
    >
        <MenuItem value="AC">Acre</MenuItem>
        <MenuItem value="AL">Alagoas</MenuItem>
        <MenuItem value="AP">Amapá</MenuItem>
        <MenuItem value="AM">Amazonas</MenuItem>
        <MenuItem value="BA">Bahia</MenuItem>
        <MenuItem value="CE">Ceará</MenuItem>
        <MenuItem value="DF">Distrito Federal</MenuItem>
        <MenuItem value="ES">Espírito Santo</MenuItem>
        <MenuItem value="GO">Goiás</MenuItem>
        <MenuItem value="MA">Maranhão</MenuItem>
        <MenuItem value="MT">Mato Grosso</MenuItem>
        <MenuItem value="MS">Mato Grosso do Sul</MenuItem>
        <MenuItem value="MG">Minas Gerais</MenuItem>
        <MenuItem value="PA">Pará</MenuItem>
        <MenuItem value="PB">Paraíba</MenuItem>
        <MenuItem value="PR">Paraná</MenuItem>
        <MenuItem value="PE">Pernambuco</MenuItem>
        <MenuItem value="PI">Piauí</MenuItem>
        <MenuItem value="RJ">Rio de Janeiro</MenuItem>
        <MenuItem value="RN">Rio Grande do Norte</MenuItem>
        <MenuItem value="RS">Rio Grande do Sul</MenuItem>
        <MenuItem value="RO">Rondônia</MenuItem>
        <MenuItem value="RR">Roraima</MenuItem>
        <MenuItem value="SC">Santa Catarina</MenuItem>
        <MenuItem value="SP">São Paulo</MenuItem>
        <MenuItem value="SE">Sergipe</MenuItem>
        <MenuItem value="TO">Tocantins</MenuItem>
    </Select>
</FormControl>
@leonardo0494

This comment has been minimized.

Copy link

@leonardo0494 leonardo0494 commented Aug 30, 2020

Muito obrigado. Se o cara existe, você é ele.

@DanieelAl

This comment has been minimized.

Copy link

@DanieelAl DanieelAl commented Sep 21, 2020

Obrigado!!

@SzhenBBK

This comment has been minimized.

Copy link

@SzhenBBK SzhenBBK commented Oct 23, 2020

Opa, salvou aquele tempo!

@Lukasrsv

This comment has been minimized.

Copy link

@Lukasrsv Lukasrsv commented Dec 8, 2020

deus te abençoe kkkk

@tiagopedrosoftmakersbr

This comment has been minimized.

Copy link

@tiagopedrosoftmakersbr tiagopedrosoftmakersbr commented Jan 29, 2021

Como faço pra te mandar um mousepad?

@FortalezaRN

This comment has been minimized.

Copy link

@FortalezaRN FortalezaRN commented Feb 10, 2021

Valeu, salvou lindamente

@fxnowteam

This comment has been minimized.

Copy link

@fxnowteam fxnowteam commented Feb 12, 2021

contribuindo para preguiça alheia, só exibindo as UF

                                    <select name="estados-brasil">
                                        <option value="AC">AC</option>
                                        <option value="AL">AL</option>
                                        <option value="AP">AP</option>
                                        <option value="AM">AM</option>
                                        <option value="BA">BA</option>
                                        <option value="CE">CE</option>
                                        <option value="DF">DF</option>
                                        <option value="ES">ES</option>
                                        <option value="GO">GO</option>
                                        <option value="MA">MA</option>
                                        <option value="MT">MT</option>
                                        <option value="MS">MS</option>
                                        <option value="MG">MG</option>
                                        <option value="PA">PA</option>
                                        <option value="PB">PB</option>
                                        <option value="PR">PR</option>
                                        <option value="PE">PE</option>
                                        <option value="PI">PI</option>
                                        <option value="RJ">RJ</option>
                                        <option value="RN">RN</option>
                                        <option value="RS">RS</option>
                                        <option value="RO">RO</option>
                                        <option value="RR">RR</option>
                                        <option value="SC">SC</option>
                                        <option value="SP">SP</option>
                                        <option value="SE">SE</option>
                                        <option value="TO">TO</option>
                                    </select>

abençoado!

@cortelucas

This comment has been minimized.

Copy link

@cortelucas cortelucas commented Feb 17, 2021

Lindo

@wictor-parmenis

This comment has been minimized.

Copy link

@wictor-parmenis wictor-parmenis commented Mar 11, 2021

te amo

@LeoDev-bee-boop

This comment has been minimized.

Copy link

@LeoDev-bee-boop LeoDev-bee-boop commented Mar 25, 2021

Obrigado seu maravilhoso.

@DilmarJunior

This comment has been minimized.

Copy link

@DilmarJunior DilmarJunior commented Apr 2, 2021

Salvou muito !!

@JoaoBarrosVerde

This comment has been minimized.

Copy link

@JoaoBarrosVerde JoaoBarrosVerde commented Apr 12, 2021

Excelente para usar com React JS

const states = [
  { value: 'AC', label: 'Acre' },
  { value: 'AL', label: 'Alagoas' },
  { value: 'AP', label: 'Amapá' },
  { value: 'AM', label: 'Amazonas' },
  { value: 'BA', label: 'Bahia' },
  { value: 'CE', label: 'Ceará' },
  { value: 'DF', label: 'Distrito Federal' },
  { value: 'ES', label: 'Espírito Santo' },
  { value: 'GO', label: 'Goiás' },
  { value: 'MA', label: 'Maranhão' },
  { value: 'MT', label: 'Mato Grosso' },
  { value: 'MS', label: 'Mato Grosso do Sul' },
  { value: 'MG', label: 'Minas Gerais' },
  { value: 'PA', label: 'Pará' },
  { value: 'PB', label: 'Paraíba' },
  { value: 'PR', label: 'Paraná' },
  { value: 'PE', label: 'Pernambuco' },
  { value: 'PI', label: 'Piauí' },
  { value: 'RJ', label: 'Rio de Janeiro' },
  { value: 'RN', label: 'Rio Grande do Norte' },
  { value: 'RS', label: 'Rio Grande do Sul' },
  { value: 'RO', label: 'Rondônia' },
  { value: 'RR', label: 'Roraima' },
  { value: 'SC', label: 'Santa Catarina' },
  { value: 'SP', label: 'São Paulo' },
  { value: 'SE', label: 'Sergipe' },
  { value: 'TO', label: 'Tocantins' }
];
@matheuscampbell

This comment has been minimized.

Copy link

@matheuscampbell matheuscampbell commented Apr 17, 2021

Ajuda muito os preguiçosos vlw!! haha!

@sauloraizen

This comment has been minimized.

Copy link

@sauloraizen sauloraizen commented Apr 28, 2021

Demorei muito
Pra te encontar
Agora eu quero só você...

@carlosnani

This comment has been minimized.

Copy link

@carlosnani carlosnani commented May 12, 2021

Obrigado!

@bernardogontijo

This comment has been minimized.

Copy link

@bernardogontijo bernardogontijo commented May 17, 2021

maravilha

@MathiasOliveira

This comment has been minimized.

Copy link

@MathiasOliveira MathiasOliveira commented May 26, 2021

Esse cara é foda.

@adonyskevin

This comment has been minimized.

Copy link

@adonyskevin adonyskevin commented Jun 1, 2021

Obrigado amigo, você é um amigo.

@HonoratoAdilson

This comment has been minimized.

Copy link

@HonoratoAdilson HonoratoAdilson commented Jun 9, 2021

Só tem anjo nesse post contribuindo com a preguiça alheia!

Obrigado aos envolvidos

@RC0D3

This comment has been minimized.

Copy link

@RC0D3 RC0D3 commented Jun 11, 2021

Laravel -> Blade template engine
(XGH) prazo tá apertado aqui pra ficar arrumando tão bem...

(Modo preguiçoso para recordar o valor, daria para fzr um js ou foreach...)


<select name="uf" required>
        <option value="">Escolher...</option>
        <option value="AC" @if(old('uf')== "AC") selected="selected" @endif>Acre</option>
        <option value="AL" @if(old('uf')== "AL") selected="selected" @endif>Alagoas</option>
        <option value="AP" @if(old('uf')== "AP") selected="selected" @endif>Amapá</option>
        <option value="AM" @if(old('uf')== "AM") selected="selected" @endif>Amazonas</option>
        <option value="BA" @if(old('uf')== "BA") selected="selected" @endif>Bahia</option>
        <option value="CE" @if(old('uf')== "CE") selected="selected" @endif>Ceará</option>
        <option value="DF" @if(old('uf')== "DF") selected="selected" @endif>Distrito Federal</option>
        <option value="ES" @if(old('uf')== "ES") selected="selected" @endif>Espírito Santo</option>
        <option value="GO" @if(old('uf')== "GO") selected="selected" @endif>Goiás</option>
        <option value="MA" @if(old('uf')== "MA") selected="selected" @endif>Maranhão</option>
        <option value="MT" @if(old('uf')== "MT") selected="selected" @endif>Mato Grosso</option>
        <option value="MS" @if(old('uf')== "MS") selected="selected" @endif>Mato Grosso do Sul</option>
        <option value="MG" @if(old('uf')== "MG") selected="selected" @endif>Minas Gerais</option>
        <option value="PA" @if(old('uf')== "PA") selected="selected" @endif>Pará</option>
        <option value="PB" @if(old('uf')== "PB") selected="selected" @endif>Paraíba</option>
        <option value="PR" @if(old('uf')== "PR") selected="selected" @endif>Paraná</option>
        <option value="PE" @if(old('uf')== "PE") selected="selected" @endif>Pernambuco</option>
        <option value="PI" @if(old('uf')== "PI") selected="selected" @endif>Piauí</option>
        <option value="RJ" @if(old('uf')== "RJ") selected="selected" @endif>Rio de Janeiro</option>
        <option value="RN" @if(old('uf')== "RN") selected="selected" @endif>Rio Grande do Norte</option>
        <option value="RS" @if(old('uf')== "RS") selected="selected" @endif>Rio Grande do Sul</option>
        <option value="RO" @if(old('uf')== "RO") selected="selected" @endif>Rondônia</option>
        <option value="RR" @if(old('uf')== "RR") selected="selected" @endif>Roraima</option>
        <option value="SC" @if(old('uf')== "SC") selected="selected" @endif>Santa Catarina</option>
        <option value="SP" @if(old('uf')== "SP") selected="selected" @endif>São Paulo</option>
        <option value="SE" @if(old('uf')== "SE") selected="selected" @endif>Sergipe</option>
        <option value="TO" @if(old('uf')== "TO") selected="selected" @endif>Tocantins</option>
        </select>
@grgbrasil

This comment has been minimized.

Copy link

@grgbrasil grgbrasil commented Jun 26, 2021

Vue select com busca e imagem:

<template>
  <div>
    <div class="input-group">
      <input v-model="filtro" @click="showlist=1" class="form-control">
      <div  @click="showlist=1" class="input-group-append">
        <button  @click="showlist=1" class="btn btn-secondary" type="button"><i class="fal fa-arrow-down"></i></button>
      </div>
    </div>
    <div v-show="showlist==1" style="height: 160px; overflow-y: scroll;background-color: white; position:absolute; z-index: 999; width: 100%; border: solid thin #e5e5e5;">
      <div v-for="item in estados" @click='seleciona(item.id,item.nome)' :value="item.id" v-show="(item.id + ' ' + item.nome).toLowerCase().includes(filtro.toLowerCase())">
        <span class="'flag-icon flag-icon-squared'"><img v-show="item.id!=''" :src="'https://sijur.com.br/sistema/app/assets/local/img/uf/' + item.id.toLowerCase() + '.gif'" height="12px"></span>
        <span class="flag-text">{{item.nome}}</span>
      </div>
    </div>
  </div>
</template>


<script>


module.exports = {
  props: {value:''},
  data:function () {
    return {
      filtro:'', showlist:false,
      estados : [
        {id: '', nome: 'Selecione'},
        {id: 'AC', nome: 'Acre'},
        {id: 'AL', nome: 'Alagoas'},
        {id: 'AP', nome: 'Amapá'},
        {id: 'AM', nome: 'Amazonas'},
        {id: 'BA', nome: 'Bahia'},
        {id: 'CE', nome: 'Ceará'},
        {id: 'DF', nome: 'Distrito Federal'},
        {id: 'ES', nome: 'Espírito Santo'},
        {id: 'GO', nome: 'Goiás'},
        {id: 'MA', nome: 'Maranhão'},
        {id: 'MT', nome: 'Mato Grosso'},
        {id: 'MS', nome: 'Mato Grosso do Sul'},
        {id: 'MG', nome: 'Minas Gerais'},
        {id: 'PA', nome: 'Pará'},
        {id: 'PB', nome: 'Paraíba'},
        {id: 'PR', nome: 'Paraná'},
        {id: 'PE', nome: 'Pernambuco'},
        {id: 'PI', nome: 'Piauí'},
        {id: 'RJ', nome: 'Rio de Janeiro'},
        {id: 'RN', nome: 'Rio Grande do Norte'},
        {id: 'RS', nome: 'Rio Grande do Sul'},
        {id: 'RO', nome: 'Rondônia'},
        {id: 'RR', nome: 'Roraima'},
        {id: 'SC', nome: 'Santa Catarina'},
        {id: 'SP', nome: 'São Paulo'},
        {id: 'SE', nome: 'Sergipe'},
        {id: 'TO', nome: 'Tocantins'}
      ]
    }
  },
  watch: {
    value: function(newValue){this.id=newValue;return;}
  },
  methods:{
    atualiza(){
      this.$emit("change",this.id);
      this.$emit("input",this.id);
    },
    seleciona(id,nome){
      this.filtro=nome;
      this.id=id;
      this.showlist=0;
      this.atualiza();
    },

  },

}
</script>

<style scoped>

span.select2 {
  width: 300px !important;
}

.flag-text {
  margin-left: 10px;
}

.flag-icon,
.flag-icon-background {
  background-repeat: no-repeat;
  background-size: contain;
  background-position: 50%
}

.flag-icon {
  position: relative;
  display: inline-block;
  width: 1.33333333em;
  line-height: 1em
}

.flag-icon:before {
  content: "\00a0"
}

.flag-icon.flag-icon-squared {
  width: 1em
}
</style>
@gusttavocaruso

This comment has been minimized.

Copy link

@gusttavocaruso gusttavocaruso commented Aug 26, 2021

Valeu!!

@ArthurDeveloper

This comment has been minimized.

Copy link

@ArthurDeveloper ArthurDeveloper commented Aug 27, 2021

Valeu por poupar meu trabalho! Kkkkkkkkkkkkkkk

@HugoDaniel2000

This comment has been minimized.

Copy link

@HugoDaniel2000 HugoDaniel2000 commented Sep 16, 2021

function createOptions (){
  const arrayStates = ['AC', 'AL', 'AP', 'AM', 'BA', 'CE', 'DF', 'ES', 'GO', 'MA', 'MT', 'MS', 'MG', 'PA', 'PB', 'PR', 'PE', 'PI', 'RJ', 'RN', 'RS', 'RO', 'RR', 'SC', 'SP', 'SE', 'TO']
  for (let index = 0; index < arrayStates.length ; index += 1) {
  const option =  arrayStates[index];
  const createOptions = document.createElement('option');
  createOptions.innerText = option;
  createOptions.value = option;
  selectedOptions.appendChild(createOptions);
  }
}
createOptions();``
@joaosantiag0

This comment has been minimized.

Copy link

@joaosantiag0 joaosantiag0 commented Sep 21, 2021

public ICollection States { get; } = new List
{
new("", ""),
new("Acre","AC"),
new("Alagoas","AL"),
new("Amapá","AP"),
new("Amazonas","AM"),
new("Bahia","BA"),
new("Ceará","CE"),
new("Distrito Federal","DF"),
new("Espírito Santo","ES"),
new("Goiás","GO"),
new("Maranhão","MA"),
new("Mato Grosso","MT"),
new("Mato Grosso do Sul","MS"),
new("Minas Gerais","MG"),
new("Pará","PA"),
new("Paraíba","PB"),
new("Pernambuco","PE"),
new("Piauí", "PI"),
new("Rio de Janeiro", "RJ"),
new("Rio Grande do Norte","RN"),
new("Rio Grande do Sul", "RS"),
new("Rondônia","RO"),
new("Roraima", "RR"),
new("Santa Catarina","SC"),
new("São Paulo", "SP"),
new("Sergipe","SE"),
new("Tocantins", "TO")
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment