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

commented Oct 10, 2016

Obrigado, me poupou o cornoJob! kkkk

@heitoralthmann

This comment has been minimized.

Copy link

commented Oct 27, 2016

Obrigado! :)

@thcborges

This comment has been minimized.

Copy link

commented Nov 12, 2016

Muito obrigado!!

@Leomhl

This comment has been minimized.

Copy link

commented Dec 29, 2016

Extremamente útil!

@cscholles

This comment has been minimized.

Copy link

commented Dec 29, 2016

obrigada! 👍

@natan88

This comment has been minimized.

Copy link

commented Jan 3, 2017

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

@william-keller

This comment has been minimized.

Copy link

commented Jan 23, 2017

valeu, Obrigado!

@jsvini

This comment has been minimized.

Copy link

commented Jan 30, 2017

the lazy ones thank you

@antenando

This comment has been minimized.

Copy link

commented Feb 8, 2017

parabéns, tá ótemo

@fernandobhz

This comment has been minimized.

Copy link

commented Mar 15, 2017

value

@GuigaK

This comment has been minimized.

Copy link

commented Mar 23, 2017

Valeu!

@woxpeso

This comment has been minimized.

Copy link

commented Mar 24, 2017

Valeu :D

@wilianuhlmann

This comment has been minimized.

Copy link

commented Mar 29, 2017

Obrigado!

@gabrielmancini

This comment has been minimized.

Copy link

commented Apr 21, 2017

vlw

@sunictec

This comment has been minimized.

Copy link

commented May 2, 2017

Te amo

@kessejones

This comment has been minimized.

Copy link

commented May 18, 2017

Muito Bom!

@tabitaaet

This comment has been minimized.

Copy link

commented May 26, 2017

Obrigada!

@osouzajefferson

This comment has been minimized.

Copy link

commented Jun 21, 2017

Nossa, valeu muito!

@hevertoncastro

This comment has been minimized.

Copy link

commented Jul 4, 2017

Ajudou bem! 👍

@harissonmatos

This comment has been minimized.

Copy link

commented Jul 6, 2017

Obrigado

@fontesmarcio

This comment has been minimized.

Copy link

commented Jul 12, 2017

Obrigado

@AllanPinheiroDeLima

This comment has been minimized.

Copy link

commented Jul 12, 2017

Estrelinha pela ajuda, mano

@devrsantos

This comment has been minimized.

Copy link

commented Jul 21, 2017

Valew

@Andreolle

This comment has been minimized.

Copy link

commented Aug 9, 2017

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

@Reifefe

This comment has been minimized.

Copy link

commented Aug 17, 2017

Perfeito! Obrigado.

@jozadaquebatista

This comment has been minimized.

Copy link

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

commented Aug 30, 2017

Valeu, me poupou tempo ... haha

@CViniciusSDias

This comment has been minimized.

Copy link

commented Sep 5, 2017

Nem todo herói usa capa.

@kkassia

This comment has been minimized.

Copy link

commented Sep 9, 2017

Obrigada

@nanduzz

This comment has been minimized.

Copy link

commented Sep 12, 2017

Obrigado :)

@tkrempser

This comment has been minimized.

Copy link

commented Sep 13, 2017

Obrigado!

@AlexandroWillianHervis

This comment has been minimized.

Copy link

commented Sep 27, 2017

Shooow, valeu!!!

@nataliaalves03

This comment has been minimized.

Copy link

commented Oct 8, 2017

Valeu! :D

@Gawiga

This comment has been minimized.

Copy link

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

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

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

commented Oct 31, 2017

Nice mlk!

@mtonet

This comment has been minimized.

Copy link

commented Nov 17, 2017

Valeu !

@srRodolfo

This comment has been minimized.

Copy link

commented Nov 27, 2017

Obrigado!

@wermerson

This comment has been minimized.

Copy link

commented Nov 29, 2017

Obrigado!

@HenriqueMarcelo

This comment has been minimized.

Copy link

commented Dec 5, 2017

Obrigado

@bcosta12

This comment has been minimized.

Copy link

commented Dec 13, 2017

Parabéns pela iniciativa, obrigado!

@giovannipds

This comment has been minimized.

Copy link

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

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

commented Jan 17, 2018

Muito obrigado pessoal!

@danillobarbosa

This comment has been minimized.

Copy link

commented Mar 11, 2018

Vlw!

@regisboliver

This comment has been minimized.

Copy link

commented Mar 13, 2018

valeu!

@lipfreitas

This comment has been minimized.

Copy link

commented Mar 15, 2018

+1 Star

Excelente trabalho!

@thelukscolor

This comment has been minimized.

Copy link

commented Mar 15, 2018

Obrigado, amigo!

@lipfreitas

This comment has been minimized.

Copy link

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

commented Apr 18, 2018

Merece um beijo

@michaelmeneses

This comment has been minimized.

Copy link

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

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

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

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

commented Jun 10, 2018

Muito obrigada, moço! Ajudou demais

@mendesrl

This comment has been minimized.

Copy link

commented Jun 18, 2018

Obrigada me ajudou muuuiitto

@setsunaslash

This comment has been minimized.

Copy link

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

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!!!

@juliavii

This comment has been minimized.

Copy link

commented Jun 27, 2018

O melhor do brasil é esse repo

@guxtavosantana

This comment has been minimized.

Copy link

commented Jul 3, 2018

Valeeu, seu lindo

@Luc45

This comment has been minimized.

Copy link

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

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

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

commented Sep 5, 2018

deus te abençoe por isso

@paulokenobi

This comment has been minimized.

Copy link

commented Sep 5, 2018

@VicenzoMartinelli

This comment has been minimized.

Copy link

commented Oct 1, 2018

isso eu chamo de contribuição pra comunidade

@jeancopati

This comment has been minimized.

Copy link

commented Oct 24, 2018

Como eu amo vocês <3

@tiicaa

This comment has been minimized.

Copy link

commented Nov 9, 2018

Pessoal, como posso implementar isso no contact form 7?

@carlosnani

This comment has been minimized.

Copy link

commented Dec 26, 2018

Obrigado, me ajudou muito.

@mscansian

This comment has been minimized.

Copy link

commented Jan 23, 2019

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

@C4stro

This comment has been minimized.

Copy link

commented Mar 24, 2019

VAAAAAAAAAAAAAALEW.

@LucasAsafe

This comment has been minimized.

Copy link

commented Apr 10, 2019

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

@DaltonDesign

This comment has been minimized.

Copy link

commented Apr 15, 2019

Valeu!
Deus te abençoe!

@heverton100

This comment has been minimized.

Copy link

commented Apr 26, 2019

Obrigado!

@ryanalencar

This comment has been minimized.

Copy link

commented Apr 27, 2019

DEUS!!! kkk

@phsantiago

This comment has been minimized.

Copy link

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

commented Sep 8, 2019

Show de bola! Muito obrigado

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.